Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Created December 9, 2022 14:08
Show Gist options
  • Select an option

  • Save cmcdevitt/8f250a773ab61a7203c45b2c9edf6e5f to your computer and use it in GitHub Desktop.

Select an option

Save cmcdevitt/8f250a773ab61a7203c45b2c9edf6e5f to your computer and use it in GitHub Desktop.
Reopen SIR
var SIRUTILS = Class.create();
SIRUTILS.prototype = {
initialize: function() {},
canReopenSIR: function( /*GlideRecord*/ incident) {
/*
Call this in UI Action Condition:
new sn_si.SIRUTILS().canReopenSIR(current)
*/
var hasRole = gs.hasRole('itil'); //pick a better role
var curState = incident.state; //Closed is 3 and draft is 10
//Add any additional test to see if the button should be visible
if (hasRole && (curState == 3)) {
return true;
}else{
return false;
}
},
reopenSIR: function( /*GlideRecord*/ incident) {
/*
Call this is your UI Action Script:
new sn_si.SIRUTILS().reopenSIR(current);
action.setRedirectURL(current);
*/
//Set the field that are important to your process!!!!
incident.state = 10; // Draft or what ever State you want
incident.substate = "";
incident.closed_by = "";
incident.closed_at = "";
incident.active = true;
incident.work_notes = "Reopened by " + gs.getUserDisplayName();
incident.update();
},
type: 'SIRUTILS'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment