If logged in user is manager then he/she can raise the requests for their sub-ordinates.

Saikeerthana
Tera Contributor

I created a variable set in catalog item. I created a open for field with reference field from User table. If logged in user is manager then he/she can raise the requests for their sub-ordinates as well. How can I achieve this using client script?

1 ACCEPTED SOLUTION

Hi,

it should be present in the advanced ref qualifier of that variable and not client script

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so if logged in user is manager then you can use this in the advanced ref qualifier

it would show the logged in user and also users who report to that

javascript: var query; var rec = new GlideRecord('sys_user'); if(rec.get('manager', gs.getUserID())) { query = 'sys_id=' + gs.getUserID() + '^ORmanager=' + gs.getUserID()}; query;

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I am getting below error, when I am writing catalog client script.

Where should I use this script? 

 

error - The object "gs" should not be used in client scripts.

I am getting this error. where Can I write this script in Variable set.

Hi,

it should be present in the advanced ref qualifier of that variable and not client script

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader