UI Action not working on Agent workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 02:30 PM
Hi Team,
I created UI action like below, this is working in UI 16 form, but not working in agent worksace
function openIncident() {
var query = 'caller_id=' + g_form.getValue('assigned_to') + '^short_description=' + g_form.getValue('short_description') + '^description=' + g_form.getValue('description') + '^priority=' + g_form.getValue('priority') +
'^assignment_group=' + g_form.getValue('assignment_group')+ '^u_ritm_number=' + g_form.getUniqueValue();
var url = new GlideURL('incident.do');
url.addParam('sys_id', '-1');
url.addParam('sysparm_stack', 'no');
url.addParam('sysparm_query', query);
var w = getTopWindow();
var newWindow = w.open(url.getURL(), "_blank");
newWindow.focus();
}
Help on the same
Thanks, Anil!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 02:44 PM
It does not look like you populated the workspace script, you checked the box but then did not fill it out. This is one of the reasons I dislike workspace. You have to dev all your UI actions twice if you would like them to work in both places.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 02:49 PM
Hi @AnilM99 ,
This is not working in workspace because the URL for workspace is different than that of the native view.
Please use this workspace client script to make it work in the workspace as well.
function onClick(g_form) {
var query = 'caller_id=' + g_form.getValue('assigned_to') + '^short_description=' + g_form.getValue('short_description') + '^description=' + g_form.getValue('description') + '^priority=' + g_form.getValue('priority') + '^assignment_group=' + g_form.getValue('assignment_group');
var url = 'now/workspace/agent/record/incident/-1/params/query/'+ query;
location.replace(url);
}
If my answer has helped with your question, please mark to helpful and correct.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:04 PM
Thanks for the reply @Karan Chhabra6 ,
The code is redirect to new window but not populating fields
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:20 PM
@AnilM99 - make sure the fields are present on the workspace form, if not, add those fields by configuring the form layout for workspace view.