Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Ref qualifier over list

Rosy14
Kilo Sage

Hi,

I have a list type field over sys_user table. I want to filter it so that it will show users with same company name as logged in user . below not working.

javascript:'company='+gs.getUserID().company;

2 ACCEPTED SOLUTIONS

Amit Verma
Kilo Patron
Kilo Patron

Hi @Rosy14 

 

Do you have the company set for the currently logged in user ? If you have recently set it up, you should logout and login again for gs.getUser().getCompanyID() to work. Refer below snips where it is working as expected for me :

 

AmitVerma_0-1709201231493.png

 

AmitVerma_1-1709201250933.png

 

AmitVerma_2-1709201273918.png

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

swathisarang98
Giga Sage

Hi @Rosy14 ,

 

Try the below code but the catch here is you need to logout and then log in and retest as this is querying company field 

 

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

 

swathisarang98_0-1709202005438.png

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

13 REPLIES 13

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

try this

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

Not working

This should work

 

Returns the company sys_id of the currently logged-in user var companyID = gs.getUser().getCompanyID();

 

And your list field is a reference to company, so the reference qualifier should be as below

 

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

 

 

-Anurag

Amit Verma
Kilo Patron
Kilo Patron

Hi @Rosy14 

 

Update the reference qualifier as below and retry :

 

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

 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.