UI action resolve button not working on agent workspace incident form. Need help.

Pachee Yang
Tera Contributor

I had issues with the ui actions on the Agent Workspace form. They were not doing anything. I fixed them by duplicating the script from the global one and creating on for the agent workspace application. I was able to get a few to work. The only one that is not working is the resolve button. I need help on how to make the resolve UI action work on the agent workspace form. Any idea on what I need to do here to have the UI action 'resolve' work to resolve the incident on first call resolution or if someone called and is requesting that it needs to be resolved? 

Note: 

I tried changing a few things in the script to see if it will work but nothing is happening. 

find_real_file.png

Condition script is: 

(current.incident_state != global.IncidentState.CLOSED && current.incident_state != global.IncidentState.RESOLVED && current.incident_state != global.IncidentState.CANCELED) && (gs.hasRole("itil") || gs.hasRole("itil_admin"))

 

Script is: 

function resolveIncident(){
//Prevents resolving incident if not in group, manager of group, or member of service desk role
var ga = new GlideAjax('CheckGroupMembership');
ga.addParam('sysparm_name',"isGroupMember");
ga.addParam('assignment_group', g_form.getDisplayBox('assignment_group').value);
ga.addParam('assignment_group_id', g_form.getValue('assignment_group'));
ga.getXMLWait();

var isMember = ga.getAnswer();

if (isMember == 'false' && !g_user.hasRole('service_desk')) {
g_form.addErrorMessage(getMessage('You must be a member of or the manager of the assigned group to mark the incident resolved'));
return false;
}

//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
var priority = g_form.getValue('priority');

g_form.setValue('u_awaiting_information', false);
g_form.setValue('incident_state', 6);
g_form.setValue('state', 6);
g_form.setValue('resolved_by', g_user.userID);
g_form.setDisplay('close_notes', true);
g_form.setMandatory('close_notes', true);
g_form.setDisplay('close_code', true);
g_form.setMandatory('close_code', true);
g_form.setMandatory('u_incident_cause_owner', true);
g_form.setMandatory('u_incident_cause_code', true);
g_form.setMandatory('u_incident_cause_reason', true);
g_form.setMandatory('assigned_to',true);
g_form.setMandatory('work_notes',false);

if (priority == '1' || priority == '2'){
g_form.setMandatory('u_incident_start', true);
g_form.setMandatory('u_incident_end', true);
g_form.setMandatory('u_change_required',true);
//g_form.setMandatory('rfc',true);
}

gsftSubmit(null, g_form.getFormElement(), 'resolve_incident'); //MUST call the 'Action name' set in this UI Action
}

//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverResolve();

function serverResolve(){
current.incident_state = global.IncidentState.RESOLVED;
current.state = global.IncidentState.RESOLVED;
current.update();
current.resolved_by = gs.getUserID();
}

6 REPLIES 6

Hi Anas,

There is no UI Action on incident table with the Action name as 'aw_resolve_incident'. Pachee Yang has duplicated the UI Action for Agent Workspace with this name. That is why you are getting this error message.

The original UI Action in Rome Release is in the Global Application which is as follows;

find_real_file.png

Make sure you have this statement with correct UI Action name in the script.

find_real_file.png

 

Hopefully this will help you.

ersureshbe
Giga Sage
Giga Sage

Hi,

Can you try below article which highlights same issue

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0754163.

Please mark it as correct answer if it helped.

Regards,

Suresh.

Regards,
Suresh.