Standard Ticket Header Widget 'Actions' cancel option

AJAYKUMAR G
Tera Contributor

Standard Ticket Header Widget 'Actions' 

1.cancel option available when incident state is new, inprogress

2.when selecting cancel option 
     a. Confirmation pop up asking cancelling reason
     b. if provide the reason that reason should be in incident comments

1 REPLY 1

Cheikh Ahmadou
Tera Guru

1: Show a Modal When “Cancel” Is Clicked

 

$scope.cancel = function () {
  spModal.open({
    title: "Cancel Incident",
    message: "Please provide a reason for cancelling this incident:",
    input: true, // enables text input
    value: "",   // default value
    size: "md"
  }).then(function (result) {
    if (result.button === "ok" && result.inputValue) {
      $scope.data.action = "cancel";
      $scope.data.cancel_reason = result.inputValue;
      $scope.server.update(init);
    }
  });
};

 

 

2: Modify the Server Script to Accept cancel_reason

In your server script, update this block:

 

if (input && input.action == 'cancel' && incidentGr.get(incidentSysId)) {
    incidentGr.incident_state = global.IncidentState.CLOSED;
    incidentGr.state = global.IncidentState.CLOSED;

    if (input.cancel_reason) {
        incidentGr.comments = "Cancelled by user. Reason: " + input.cancel_reason;
    } else {
        incidentGr.comments = "Cancelled by user.";
    }

    incidentGr.update();
}