Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Create a UI action to close multiple incidents

Log in to subscribe to topics and get notified when content changes.

Create a UI action to close multiple incidents

Create a UI action to close multiple incidents at once from the Actions list in the list view.

Before you begin

Role: business_rule_admin (for business rule), ui_action_admin (for UI action), or admin

About this task

Closing an incident from Actions list adds the same close note to all the incidents that are closed and does not require the list_updater role. Implementing this process requires a script include that is referred from a UI action and a custom UI page.


  1. Navigate to System Definition > Script Includes and click New.
  2. Create the script includes with the following information.
    • Name: IncidentClosure
    • Client callable: Select the check box
    • Active: Select the check box
    • Script: Paste the following information:
      var IncidentClosure = Class.create();
      IncidentClosure.prototype = Object.extendsObject(AbstractAjaxProcessor, {
          closeIncidents: function() {
              var selectedIncidents = this.getParameter("sysparm_incidents");
              var notes = this.getParameter("sysparm_closeNote");
              var code = this.getParameter("sysparm_closeCode");
              var incidentGr = new GlideRecord('incident');
              incidentGr.addQuery('sys_id', 'IN', selectedIncidents);
              while ( {
                  incidentGr.setValue('state', 7);
                  incidentGr.setValue('close_notes', notes);
                  incidentGr.setValue('close_code', code);    
              return true;
         type: 'IncidentClosure'
  3. Save the record.
  4. Create the following steps to create a UI page.
    • Name: mandatory_fields_to_close_incident_ui
    • HTML: Paste the following information:
      <?xml version="1.0" encoding="utf-8" ?>
      <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
              #content_row .reference-label {
                  padding-right: 15px;
              #page_timing_div {
                  display: none;
          <form class="form-horizontal">
              <div class="form-group">
                  <label class="col-xs-4 control-label">
                      <span style="padding-right: 5px;"></span>
                      <span class="label-text">${gs.getMessage('Resolution code')}</span>
                  <div class="col-xs-5 form-field input_controls" style="line-height: 32px;">
                      <select name="closeCode" id="closeCode">
                          <option value="" selected="SELECTED" role="option">-- None --</option>
                          <option value="Solved (Work Around)" role="option">Solved (Work Around)</option>
                          <option value="Solved (Permanently)" role="option">Solved (Permanently)</option>
                          <option value="Solved Remotely (Work Around)" role="option">Solved Remotely (Work Around)</option>
                          <option value="Solved Remotely (Permanently)" role="option">Solved Remotely (Permanently)</option>
                          <option value="Not Solved (Not Reproducible)" role="option">Not Solved (Not Reproducible)</option>
                          <option value="Not Solved (Too Costly)" role="option">Not Solved (Too Costly)</option>
                          <option value="Closed/Resolved by Caller" role="option">Closed/Resolved by Caller</option>
              <div class="form-group">
                  <label class="col-xs-4 control-label">
                      <span class="label-text" style="">${gs.getMessage('Resolution Notes')}</span>
                  <div class="col-xs-7 form-field input_controls">
                      <textarea required="true" class="form-control" value="closeNotes" id="closeNotes" type="text"></textarea>
              <div class="form-group" style="padding-right:20px;margin-bottom:0;padding-left: 75%; line-height: 45px;">
                  <g:dialog_button id="cancel_button" type="button" style_class="$btn btn-default" onclick="actionCancel()" style="min-width: 5em;">${gs.getMessage('Cancel')}</g:dialog_button>
                  <g:dialog_button id="ok_button" type="button" onclick="actionOK()" style_class="btn btn-primary" style="min-width: 5em;">${gs.getMessage('OK')}</g:dialog_button>
                  <div class="clearfix"></div>
    • Client script: Paste the following information:
      function actionOK() {
          var modal = GlideModal.prototype.get("mandatory_fields_to_close_incident_ui");
          var incidents = modal.getPreference("selected_incidents");
          if (incidents) {
              //close the incidents
              var glideAjax = new GlideAjax("IncidentClosure");
              glideAjax.addParam("sysparm_name", "closeIncidents");
              glideAjax.addParam("sysparm_incidents", incidents);
              glideAjax.addParam("sysparm_closeCode", $("closeCode").value);
              glideAjax.addParam("sysparm_closeNote", $("closeNotes").value);
              glideAjax.getXMLAnswer(function(answer) {
      function actionCancel() {
      (function() {
          var okButton = gel('ok_button');
          var closeCodeEl = gel('closeCode');
          var closeNotesEl = gel('closeNotes');
          okButton.disabled = true;
          closeNotesEl.value = "";
          closeCodeEl.on('change', function() {
              if (closeCodeEl.value !=="" && closeNotesEl.value !=="")
                  okButton.disabled = false;
                  okButton.disabled = true;
          closeNotesEl.on('input', function() {
              if (closeCodeEl.value !=="" && closeNotesEl.value !=="")
                  okButton.disabled = false;
                  okButton.disabled = true;
  5. Save the record.
  6. Complete the following steps to create the UI action for closing multiple incidents.
    1. Navigate to System Definition > UI Actions and click New.
    2. Create the UI actions with the following information:
      • Name: Close incidents
      • Table: Incident [incident]
      • Show update: Select the check box
      • List choice: Select the check box
      • List v2 Compatible: Select the check box
      • Client: Select the check box
      • Onclick: closeIncidents()
      • Condition: current.getValue('state') !== '7'
      • Script: paste the following information
      function closeIncidents() {
          var list = GlideList2.get('incident');
          var title = list.getTitle();
          var incidents = list.getChecked();
          if (incidents) {
              var o = new GlideModal('mandatory_fields_to_close_incident_ui');
                  getMessage("Close Incidents", function(msg) {
                      o.setPreference('selected_incidents', incidents);
  7. Save the record.


Service desk agents can close multiple incidents using Close incidents in the Actions list below the Incident list.