Confirmation popup on close incident.

anupriya7
Kilo Expert

As an ESS / ITIL user (legacy view and Portal View) for Incidents and Service Requests, Problem. Once i click on Close UI action Button or user change manually   state to close I should get a pop up message as confirmation "Are you sure you want to close this ticket ?"

Here I am using below code but when click on cancel incident is getting closed for UI action. Any suggestion??

  onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

var value =g_form.getValue('incident_state');// field name
if(value==7) // field value
{
if(confirm("Do you want to close"))

{

g_form.save();
}
else
{
g_form.setValue('incident_state',oldValue);

}

  }

}

6 REPLIES 6

srinivasthelu
Tera Guru

HI Anupriya,



what is your UI Action code look like? Do you want to paste it over here?


using below in ui action-


current.incident_state = IncidentState.CLOSED;


current.update();


thankyou


ohhgr
Kilo Sage

Hi Anupriya,



Do you have incident_state field on the form layout? g_form.getValue() might not work if the field is not on the form layout. (hidden or otherwise)



This is a onChange client script and you're trying to set the value of the incident state through UI Action on Server Side. If you want to stop the processing of the UI Action, use client script within the UI Action. Something like this http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/



Thanks,
Mandar