Last active
January 18, 2022 18:24
-
-
Save ChecksumFailed/96e6790307c4902d3746ba1dbce1d639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var comment = "Workflow cancelled by " + gs.getUserDisplayName(); | |
new WorkflowApprovalUtils().cancelAll(current, comment); | |
new Workflow().restartWorkflow(current); | |
current.work_notes = comment; | |
//cancel current flow context and start new | |
if (!current.cat_item.flow_designer_flow.nil() && !current.flow_context.nil()) { | |
sn_fd.FlowAPI.cancel(current.flow_context.sys_id.toString(), 'Cancelling Flow'); | |
var inputs = { | |
"request_item": current | |
}; | |
var flowName = current.cat_item.flow_designer_flow.sys_scope.scope.toString() + "." + current.cat_item.flow_designer_flow.internal_name.toString(); | |
var newContext = sn_fd.FlowAPI.startFlow(flowName, inputs); | |
current.flow_context = newContext; | |
} | |
current.update(); | |
gs.addInfoMessage(comment); | |
action.setRedirectURL(current); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment