The CreatorCon Call for Content is officially open! Get started here.

Display different user lists according to the selected department

____39
Tera Contributor

When our department selects IT, only users whose departments are IT are displayed in the user search list, and users of other departments will not be displayed.How to write in Dynamic ref qual

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

No script include is required for this

you can update your ref qualifier as this and it would work for all the scenarios you mentioned

If department is selected it would filter and show users belonging to that department

If department is not selected it would show all users

javascript: var query = ''; if(current.department) query = 'department=' + current.department; query;

Regards
Ankur

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

View solution in original post

9 REPLIES 9

Mahesh23
Mega Sage

Hi,

Try adding below reference qualifier to user field

javascript:"department="+current.department;

Chetan Mahajan
Kilo Sage
Hi, Create Advance refrence qualifier on user field, javascript:"department=" + current.department; // add department field backend value

Hi, thank you for responsing, If I did not select department, in the user search list should display all user, What should I do? Thank you!

Then, you need to create script include and call that script include in reference qualifer pass department value in that, and check in script include if department value is empty return 'active=true' else return 'department='+current.department; //or you can pass parameter here which comes from client script of department