- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
In the initial version of ReleaseOps a Deployment Request may end up in a terminal state such as Cancelled or Failed or otherwise get stuck with no way to recover and start the process over. The workaround to solve this is to run the following script in Scripts - Background or create a UI Action called "Reset" as a form link in the ReleaseOps scope.
NOTE: This exact script will work when running as a UI Action on the Release (sn_releaseops_release) or Deployment Request (sn_releaseops_deployment_request) table.
NOTE: As of Australia you should be able to change the state of a Canceled or Failed Deployment Request.
(function(current) {
// This UI Action can be used on either a Deployment Request or Release record.
// Suggest adding to the form as a link or form context to avoid accidental use.
action.setRedirectURL(current);
const targetStates = {
"sn_releaseops_deployment_request" : ReleaseOpsConstants.DEPLOYMENT_REQUEST_STATES.DRAFT,
"sn_releaseops_release": ReleaseOpsConstants.RELEASE_STATES.DRAFT
};
const tableDisplayName = current.getClassDisplayValue();
const targetState = targetStates[current.getTableName()];
const logPrefix = "ReleaseOps " + tableDisplayName + " " + current.number + ": ";
gs.info(logPrefix + "Cancelling " + current.short_description);
current.work_notes = "Cancelling playbooks and returning to state of Draft";
const pdc = new GlideRecord("sys_pd_context");
pdc.addQuery("input_record", current.sys_id);
pdc.addQuery("state", "IN", "QUEUED,IN_PROGRESS");
pdc.query();
while (pdc.next()) {
gs.info(logPrefix + ": Cancelling Plabyook Context: " + pdc.getUniqueValue());
sn_playbook.PlaybookExperience.cancelPlaybook(pdc, "Cancelled by user");
}
current.setWorkflow(false);
current.state = targetState;
const finishMsg = `Requested cancellation of any running playbooks and set state to Draft. Note: it may take a few minutes for the playbook to finalize.`;
current.work_notes = finishMsg;
gs.addInfoMessage(finishMsg);
current.update();
})(current);
- 365 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

