How to filter a Reference Variable to only show users in the same Company

Feasood
Tera Guru

Hello,

 

I have created a Reference Variable in a Catalog Item that looks at the sys_user table and currently it shows all users.

I would like to filter this variable so it only shows users in the same Company as the user raising the Catalog Item.

 

Eg:  I am filling out the form and my company is 'CompanyA'.

When typing into the reference variable field, I only want to see other users from 'CompanyA'.

 

Currently I only have this:

Feasood_0-1687403264312.png

I am still very new to ServiceNow and am not sure on how to achieve the end result I am after.

 

Thanks

Mike

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, if 'Use reference qualifier' = Advanced and you set the 'Reference qualifier' field like this

javascript: 'company=' + gs.getUser().getCompanyID();

 

Only users with the same company as the logged in user will be shown. 

View solution in original post

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, if 'Use reference qualifier' = Advanced and you set the 'Reference qualifier' field like this

javascript: 'company=' + gs.getUser().getCompanyID();

 

Only users with the same company as the logged in user will be shown. 

Thanks Tony,  that worked like a charm!

 

I really need to learn some javascript 😊