Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to show users only based on logged in user company

Sriram Pusuluri
Tera Contributor

Hi,

 

I want to show only users in a reference variable where company is child or parent.

 

Example.

Case 1:

I have logged in my company will be BTS, I have another Referance varaible(sys_user) in this variable I want to show all the company users.

 

Case 2: 

I have logged in my company will be AB Mauri, I have another Referance varaible(sys_user) in this variable I want to show only "AB Mauri BeNeFr, AB Mauri Brazil, AB Mauri Etten Leur, AB Mauri India, AB Mauri Italy, AB Mauri Malaysia, AB Mauri Mexico, AB Mauri North America, AB Mauri Pakistan, AB Mauri Philippines, AB Mauri Portugal, AB Mauri Spain, AB Mauri Sri Lanka, AB Mauri Turkey, AB Mauri UAE, AB Mauri Vietnam, Cereform, Mauri Products" company users only.

 

Note: All this companies are child to AB Mauri.

 

Case 3: 

 I have logged in my company will be GSC, I have another Referance varaible(sys_user) in this variable I want to show "AB Nutrition, AWorld, ABakeries, Allied Mills, GG, JR, Speedibake, Westmill company users only.

 

Reference Varaible name: Business Users

10 REPLIES 10

Hi Sriram,

It seems every case are different and few having static values.

In that case, Create a onChange client script on Company.

       In script , call Script Include, based on selected company , add all required user <sys_id> in  array result and pass it to client.

    Set that value in user variable.

Note: do not add hardcoded user. instead of that put sys_id of user in sys_properties. Use that sys_properties from script include.

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: