User Criteria Catalog Item
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 11:49 AM
Hello everyone,
I have created this User Criteria to prevent access to all users who contain the keyword "Manager" in their first and/or last name, it works for me but I also need it to prevent me from selecting this type of user in a variable of type reference to the "sys_user" table of my catalog item, any ideas (it's my first time using User Criteria).
Greetings and thank you.
function evaluateControl() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
var firstName = user.getValue('first_name');
var lastName = user.getValue('last_name');
firstName = firstName.toLowerCase();
lastName = lastName.toLowerCase();
var containsManager = firstName.indexOf('manager') !== -1 || lastName.indexOf('manager') !== -1;
if (containsManager) {
return false;
}
return true;
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 02:13 PM
I see...in that case, I'd recommend trying the other approach ->> replace the field on the catalog item with the "request for" type instead of a reference field to sys_user.