Service catalog user criteria - Not Available For Catalog Items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi All,
Can someone please suggest why the below criteria's script is not working.
my requirement is, ABC catalog should not be available/ visible for 'User criteria country' and for users with Job Code 'J04437 or J15505' and having ISO Code as 'MEX'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
update as this
-> you were using reverse logic
-> also use user_id in user criteria script as per best practice
-> set answer = true/false in script
-> I couldn't find User Criteria Country field on that table (why you used that)
Try using below script and uncheck Match All Checkbox
var grUser = new GlideRecord('sys_user');
if (grUser.get(user_id)) {
var code = grUser.getValue('u_job_code');
var iso = grUser.getValue('u_iso_code');
// Hide catalog if: (J04437 OR J15505) AND MEX
if ((code == "J04437" || code == "J15505") && iso == "MEX") {
answer = true; // true = HIDE catalog (Not Available For)
}
}
answer = false; // false = SHOW catalog
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
