Catalog Item Restriction

leviii
Tera Contributor

Hello, 

 

Can someone know how to restrict catalog item visibility? catalog item must be only visible specifically for users with authorization level 3 and above.  I already created a user criteria and attached it in my catalog item but it is still not working.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@leviii 

please share your user criteria and script

Ensure you add that in "Available For" Related list of your catalog item

Script something like this, but please enhance

var userRec = new GlideRecord('sys_user');
userRec.addQuery('sys_id', user_id);
userRec.addQuery('u_authorization_leve', '3'); // give your proper query here
userRec.query();
answer = userRec.hasNext();

You can also test this using User Criteria Diagnostics

Debug user criteria of a catalog item 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @leviii 

 

Ideally, it should show the user's criteria.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0812994

.

https://www.servicenow.com/community/employee-center-forum/why-does-user-criteria-not-restrict-acces...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Voona Rohila
Kilo Patron
Kilo Patron

HI @leviii 

Please share the User criteria you configured?

 

Click on Advanced and refer below sample logic (change the field name and value acordingly)

var grSysUser = new GlideRecord('sys_user');
if (grSysUser.get(user_id)) {
    if (grSysUser.u_level == '3') //change the field name and value acordingly
        answer = true;
}

 

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Ankur Bawiskar
Tera Patron
Tera Patron

@leviii 

please share your user criteria and script

Ensure you add that in "Available For" Related list of your catalog item

Script something like this, but please enhance

var userRec = new GlideRecord('sys_user');
userRec.addQuery('sys_id', user_id);
userRec.addQuery('u_authorization_leve', '3'); // give your proper query here
userRec.query();
answer = userRec.hasNext();

You can also test this using User Criteria Diagnostics

Debug user criteria of a catalog item 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@leviii 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader