We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Limit catalog items to users with specific job title

BrianS344076034
Tera Guru

I think I have 2 ways to tackle this, but looking to do it the easiest way

I have a list of catalog items that we want to limit to users that are in a specific location or have their job title contains a key word

When I look at the options to build this, i see the following

BrianS344076034_0-1770839963387.png

So I know I can do Location = "Head office" and Im good for that requirement.

For the second, I feel like there are 2 options

Option 1 - create a group in SN for all the users and manually have to keep it updated, then add that group to this Available for access

Option 2- if I click advanced there is a script option

Can this be scripted to be

Logged in user's job title contains General Manager ?

 

 

 

1 ACCEPTED SOLUTION

fknell
Mega Patron

Hi @BrianS344076034,

why not adding the users to a group while import? Like either having a VIP user group and sync it from AD to SN or adding people from a site or with a set of attributes, e.g. job title to a group. 

 

What do you think?

View solution in original post

3 REPLIES 3

velluri
Tera Contributor

Yes, You can use the option 2 by writing the Script .
//Sample Script

var userID = gs.getUserID();
var checkDep = new GlideRecord('sys_user');
checkDep.addQuery('sys_id', userID);
checkDep.query();
if (checkDep.next()) {
    if (checkDep.department.getDisplayValue() == 'IT') {  // can replace the Department with jobtitle
        answer = true;
    } else
        answer = false;
}

fknell
Mega Patron

Hi @BrianS344076034,

why not adding the users to a group while import? Like either having a VIP user group and sync it from AD to SN or adding people from a site or with a set of attributes, e.g. job title to a group. 

 

What do you think?

Yeah, i went the build a group route

did a one time flow of "if job title contains X add to group"

then a new ongoing flow for when a User record is created or updated, if they have X job title add to group

 

Thanks!