diff --git a/UI Actions/Cancel Incident/readme.md b/UI Actions/Cancel Incident/readme.md new file mode 100644 index 0000000000..62710388e3 --- /dev/null +++ b/UI Actions/Cancel Incident/readme.md @@ -0,0 +1 @@ +This is a ui action run on incident table which is client callable, run on condition current.state == '1' which means when state is new.It cancel the incident through the form. diff --git a/UI Actions/Cancel Incident/script.js b/UI Actions/Cancel Incident/script.js new file mode 100644 index 0000000000..fd7a2f0c96 --- /dev/null +++ b/UI Actions/Cancel Incident/script.js @@ -0,0 +1,17 @@ +function cancelIncident(){ + var gm = new GlideModal("glide_ask_standard", false, 600); // glide modal to get the confirmation + gm.setPreference("title", "Are you sure you wanna cancel incident!!!"); + gm.setPreference("onPromptComplete", function() { + gsftSubmit(null,g_form.getFormElement(),'cancel_incident');}); //calling same ui action + gm.render(); + +} + +if(typeof window == 'undefined'){ + serverCancel(); +} + +function serverCancel(){ + current.state = '8'; //setting the state to canceled + current.update(); +}