UI action resolve button not working on agent workspace incident form. Need help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 10:54 AM
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.
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();
}
- Labels:
-
Agent Workspace
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 11:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 11:51 AM
Just tried this, but it did not allow the 'resolve' functionality to work...
Still no action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 12:35 PM
Use this error message to verify whether the control is going into the serverResolve() function or not. Just trying to debug your code.
function serverResolve(){
gs.addErrorMessage('Testing'); //This statement to debug your code.
current.incident_state = global.IncidentState.RESOLVED;
current.state = global.IncidentState.RESOLVED;
current.resolved_by = gs.getUserID();
current.update(); //This statement should be the last.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2022 03:11 AM