Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate choice list options based on logged in user group membership

benrollins
Kilo Expert

I have a choice list which is populated by a reference field, which has quite a lot of options.
I would like to be able to reduce the number of options based on the group membership of the logged in user.

Ex:
If I have 10 values populating this choice list, and a user who is a member of group X selects the dropdown, they will only see the first 5.
A user who is a member of group Y will only see the last 5 options.
A user who is a member of both groups will see all 10 options.

I believe I will need to use an On Load client script, but have not found a way to query for a group membership of the current user, and restrict (or show) the options accordingly.

1 ACCEPTED SOLUTION

It will allow multiple group member values. This can be achieved.

g_scratchpad.memberCapex = true;
g_scratchpad.memberAdmin = true;

I haven't used the scratchpad much yet, am I able to define multiple results?  In the BR you referred to g_scratchpad.member but the Client Script if statment just used g_scratchpad.--  Sorry for the typo it should be g_scratchpad.memberCapex = true; in the client script too


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

10 REPLIES 10

Great, I am glad you were able to get it working!