How to autopopulate a field based on a user's role using an object trigger?
We have created an object trigger.
Object: Activity
Trigger: After Create
Script:
def Field=Field
def secCtx = adf.context.getSecurityContext()
if (secCtx.isUserInRole('Role1')||('Role2')||('Role3')){Field = 'YES';
}
else if (secCtx.isUserInRole('Role4')||('Role5')){Field = 'NO';
}
It was working for Roles 1-5. However, it is also auto-populating as 'YES' for other roles (Role6, Role7, etc.) which should not happen. This field should only be null/blank/no value for other roles.
What would be the possible reason for this?
0