Catalog item Available For user criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 08:58 PM
Hello Experts,
I have a requirement to make catalog item available from portal, if logged in user has role 'itil' and belong to a specific business name (which is defined through a custom string type field in user table)
I have defined the catalog item Available for as below, however it still displays for any logged in user
Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 09:39 PM
So did you add debugging in the user criteria? To see if it is triggered at all? If the if condition is reached? Etcetera?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 10:27 PM
Hi,
While running the script using 'user_id', it show the error as mentioned above in debugger.
While running the script using the gs.getUserID(), it returns the logged in user sys_id. but fails enter the if condition.
Can you let me know on the debugging steps to identify the exact issue? I usually used the log/info messages to debug.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 12:24 AM - edited 07-26-2024 12:25 AM
I'm not talking about any debugger, you already tested the basic code in background script so that's fine. Now just test the User Criteria how you would normally run it, add debugging in the script itself, for example that in system log you can see the result, etc..
Debugging your script will show the issue within a few seconds.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field