Reference Qualifier - Show Users with specific role

Brian147
Tera Contributor

I have a reference field on my form, that currently references our user table. However, I have a role in my scoped app, and I only want that field to reference users who have the specific role. I cannot use getRoledUsers() from the OOTB business rules, as this reference field is within a scoped app. (As far as I understand, the OOTB can only be called in the global scope) 

If anyone could help me out, that would be great. I don't have any code, but a generic answer of how I would go about refining my reference qualifier based on a role, whether its through a scoped business rule, script include, or just javascript in an advanced qualifier, would be of much help.

Thanks.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can try to use this

javascript:'roles=yourRoleName';

OR

you can also use script include and get all users with that role by querying sys_user_has_role table; store the user sysIds in array and then return that array

Regards
Ankur

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can try to use this

javascript:'roles=yourRoleName';

OR

you can also use script include and get all users with that role by querying sys_user_has_role table; store the user sysIds in array and then return that array

Regards
Ankur

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