You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to autopopulate a field based on a user's role using an object trigger?

edited May 20, 2024 2:57PM in Sales 7 comments

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?

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!