Unable to fetch users with 'ITIL' role using g_modal in UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 01:16 AM
Hi All,
I have create a UI form in Service Operations Workspace in which we have 'Approver' reference field. Requirement is to fetch only users with ITIL role in that field. Below is the sample code i tried,
Ui action workspace code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 03:17 AM
why you want to see active=false users? Should it not be active=true?
try this and add extra condition
var approve = [{
type: 'reference',
name: 'assigned_to',
label: getMessage('Approver'),
mandatory: true,
reference: 'sys_user',
query: 'active=false^roles=itil',
referringTable: 'sc_req_item',
referringRecordId: g_form.getUniqueValue(),
}];
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 05:29 AM
Hi @Ankur Bawiskar ,
Thank you for the response, but this is not working because 'assigned_to' field has its own reference qualifier and this query ('query: 'active=true^roles=itil') is not helping to fetch all users.
Please help me out if there is a way to make the custom query work overriding the reference qualifier.
Thanks,
Sai Surendra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 07:00 AM
Hi @saisurendra
The only workaround I found until now is to create a new field with the right reference qualifier, and use that to show the right users. It's not optimal, but I think the best we have at this moment.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 07:18 AM
Can you try putting the condition on view on reference qualifier if it is default_view then basic reference qualifier condition else if it is workspace view then call another script include.
Hope it helps