User Criteria script based on an access group membership

mattrom1
Giga Expert

Hello,

We have a 2 tables setup 1 called Access Groups and another called Access Group members. I want to have a user criteria script to state, if user is part of this access group, they can see this catalog item. if they are not, then it is not showing.

 

how would that be scripted?

4 REPLIES 4

Allen Andreas
Administrator
Administrator

You can just go to the catalog item itself, scroll down to bottom and look for available for or not available for, click new and set a parameter like so:

find_real_file.png


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I know of this part but the item i want is not the OOB item listed there. It is a custom table

Mike Patel
Tera Sage

You can do advance script something like. Add your table and query below is way on how you can do it.

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', gs.getUserID());
gr.addEncodedQuery('department.name=Techonology');
gr.addActiveQuery();
gr.query();
gr.next();

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Your script basically needs to provide a true or false answer.  The following Doc provides a few examples:

https://docs.servicenow.com/bundle/kingston-it-service-management/page/product/service-catalog-manag...