Capturing end user feedback at Incident Resolving

General Add comments
by:

Let me capture that...

In the ServiceNow out of the box setting there is a button which allows the user to resolve the incident. This button sets the incident to state Resolved.
This functionality is provided by a UI Action and a Business Rule. However, all incidents that are resolved this way are provided with a standard ServiceNow text.

Below I’ve included the ServiceNow out-of-the-box UI Action and Business Rule that facilitate the default functionality.

Functionality 

UI Action 

Name 

Resolve Incident 

Condition 

(current.incident_state != 7 && current.incident_state != 6) && (gs.hasRole(“itil”) || gs.hasRole(“itil_admin”) || current.caller_id == gs.getUserID())

Script 

current.incident_state = 6;

current.update(); 

 

Functionality 

Business Rule 

Name 

Caller Close 

Client 

false 

Condition 

current.caller_id == gs.getUserID() && (current.incident_state.changesTo(6) || current.incident_state.changesTo(7))

Script 

if (current.close_code.nil())

current.close_code = “Closed/Resolved by Caller”;

if (current.close_notes.nil())

current.close_notes = “Closed by Caller”;

 

var link = ‘<a href=”incident.do?sys_id=’ + current.sys_id + ‘” class=”breadcrumb” >’ + current.number + ‘</a>’;

var message = gs.getMessage(‘Incident’) + ‘ ‘ + link + ‘ ‘;

if (current.incident_state.changesTo(7))

message += gs.getMessage(‘has been permanently closed’);

else

message += gs.getMessage(‘has been resolved’);

gs.addInfoMessage(message); 

 

In the resolving-process it can be useful to understand what the cause was from end-user perspective and how it was solved. The Service Desk can analyse the provided information and see if the end user can be supported in a different way regarding the close notes. Customer satisfaction can be raised when investigating if such a situation can be prevented in future.

To provide the end user the ability to update the incident without changing the standard security rules, an UI Page can be created. Also some out-of-the-box functionality described above will require some changes.

The UI Action described above is changed as follows:

  • In the condition only the end user (caller) is allowed to resolve this incident and only if the incident is in incident state “New”. The condition will look like below. This can be changed depending on the situation on how organizations want to use this.

Functionality 

UI Action 

Name 

Resolve Incident 

Onclick 

resolve() 

Client 

true 

Condition 

current.incident_state == 1 && current.caller_id == gs.getUserID()

Script 

function resolve() {

var gdw = new GlideDialogWindow(‘ess_resolve_incident’);

gdw.setPreference(“sysparm_incident_sys_id”, gel(‘sys_uniqueValue’).value);

gdw.setTitle(‘Resolve incident’);

gdw.render();

} 


This UI Action will trigger a custom made UI Page named “ess_resolve_incident”. This UI Page is defined as follows:

Functionality

UI Page

Name

ess_resolve_incident

Category

— None —

Description 

This page is used to resolve the incident with corresponding close notes provided by the end-user.

HTML 

<?xml version=”1.0″ encoding=”utf-8″ ?>

<j:jelly trim=”false” xmlns:j=”jelly:core” xmlns:g=”glide” xmlns:j2=”null” xmlns:g2=”null”>

<g:ui_form>

<input type=”hidden” id=”incident_sys_id” name=”incident_sys_id” value=”${sysparm_incident_sys_id}”></input>

<h3>Please provide the close notes below to resolve this incident:</h3>

<textarea name=”provided_close_notes” id=”provided_close_notes” rows=”10″ cols=”100%”></textarea>

<g:dialog_form_buttons_ok_cancel ok=”return validateResolve()” cancel=”destroyWindow()” />

</g:ui_form>

</j:jelly> 

Client script 

function trim(value) {

value = value.replace(/^\s+/,”);

value = value.replace(/\s+$/,”);

return value;

}

 

function destroyWindow() {

GlideDialogWindow.get().destroy();

}

 

function validateResolve() {

if(trim(gel(‘incident_close_notes’).value) == “”) {

alert(“Please provide a close code before resolving the incident”);

return false;

}

destroyWindow();

} 

Processing script 

resolveIncident();

 

function resolveIncident() {

var grincident = new GlideRecord(‘incident’);

grincident.addQuery(‘sys_id’, incident_sys_id);

grincident.query();

if(grincident.next()) {

grincident.incident_state = 6;

grincident.close_notes = provided_close_notes;

grincident.close_code = ‘Closed/Resolved by Caller’;

grincident.u_cause_code = ‘Closed by customer’;

grincident.update();

 

response.sendRedirect(grincident.getLink(true));

}

} 


Because the UI Page provides some system-filled data, some lines have to be removed from the out-of-the-box Business Rule. The result is included in the table below.

Functionality 

Business Rule

Condition

current.caller_id == gs.getUserID() && (current.incident_state.changesTo(6) || current.incident_state.changesTo(7))

Script

if (current.close_code.nil())

current.close_code = “Closed/Resolved by Caller”;

 

var link = ‘<a href=”incident.do?sys_id=’ + current.sys_id + ‘” class=”breadcrumb” >’ + current.number + ‘</a>’;

var message = gs.getMessage(‘Incident’) + ‘ ‘ + link + ‘ ‘;

if (current.incident_state.changesTo(7))

message += gs.getMessage(‘has been permanently closed’);

else

message += gs.getMessage(‘has been resolved’);

gs.addInfoMessage(message);


That’s it – now you are ready to test the new functionality!

The end result should look like this:

  • End user reports incident by using the portal


 

  • A new incident is created


 

  • When clicking on the button Resolve Incident a popup will be visible


 

  • The end user is requested to fill in the close notes and click OK
  • The incident will be resolved with the provided end user Close Notes


Easy and useful for many organizations.
If you have any question on this article, please don’t hesitate to contact me at kelvin.lim@2e2.nl

Leave a Reply