Force g_modal field reference query in Agent Workspace UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 11:54 AM
Hello --
Anyone have any luck forcing an Agent Workspace client script reference field query to work? I'm building a custom UI action ("Change Assignment") which is nearly working -- it gives the user a list of ALL assignment groups, instead of respecting the dynamic query ("userDYNAMIC90d1921e5f510100a9ad2572f2b477fe").
I'm a bit stuck; I found many similar threads in recent years but no clear answers, so I'd be curious if anyone has a fresh perspective. Thanks!
Workspace Client Script:
function onClick(g_form) {
var fields = [{
type: 'reference',
name: 'assignment_group',
label: getMessage('Please select one of your current assignment groups. The case will be automatically assigned to you after clicking OK.'),
mandatory: true,
reference: 'sys_user_grmember',
query: "userDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
referringTable: 'sn_hr_core_case',
referringRecordId: g_form.getUniqueValue()
}
];
g_modal.showFields({
title: "Change Case Assignment",
fields: fields,
size: 'lg'
}).then(function(fieldValues) {
g_form.setValue('assignment_group', fieldValues.updatedFields[0].value);
g_form.save();
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 02:11 AM
Hello together,
To my knowledge, the "g_modal" function with a reference selection does only provide the possibility to select the values from the selected field.
As mentioned by other, you would need to create a UI Page and parse everything to it what you need. You can have a look into this article here: https://www.servicenow.com/community/developer-forum/how-to-call-a-ui-page-by-ui-action-in-workspace...
However, others have already pointed out the right solution way here.
Cheers,
Julian