UI Action not working on Agent workspace

AnilM99
Tera Expert

Hi Team,

 

I created UI action like below, this is working in UI 16 form, but not working in agent worksace 

 

AnilM99_2-1683063023071.png

 

 

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();

}

 

AnilM99_1-1683062855005.png

 

Help on the same

Thanks, Anil!

4 REPLIES 4

DrewW
Mega Sage
Mega Sage

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.

 

Karan Chhabra6
Mega Sage
Mega Sage

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!

 

Thanks for the reply @Karan Chhabra6 , 

The code is redirect to new window but not populating fields 

 

Thanks!

@AnilM99  - make sure the fields are present on the workspace form, if not, add those fields by configuring the form layout for workspace view.