- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 11:01 PM
Hi,
I'm trying to set up a User Criteria script for a catalog item that allows users with the employee number "192" to view the catalog item. Users with any other employee number should not be able to view the item. Below is my script, but I'm not getting the desired output. Can anyone help me troubleshoot?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 11:05 PM
try this
var userId = user_id;
var gr = new GlideRecord('sys_user');
if (gr.get(userId)) {
var employeeNumber = gr.getValue('employee_number');
if (employeeNumber == '192') {
answer = true;
} else
answer = false;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 11:05 PM
try this
var userId = user_id;
var gr = new GlideRecord('sys_user');
if (gr.get(userId)) {
var employeeNumber = gr.getValue('employee_number');
if (employeeNumber == '192') {
answer = true;
} else
answer = false;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 12:26 AM
Thank you @Ankur Bawiskar . It's working.