Cancel and restart workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2017 02:49 PM
I have created a script to cancel and restart a workflow since I can seem to find a way to restart a workflow without canceling all running workflows for a current record. This script is canceling the current workflow, but not creating a new one. What is wrong here? pradeepksharma any ideas?
//If planned start date changes, then restart the workflow
if (current.start_date.changes()) {
//Query for all executing workflow contexts
var vFlows = new Workflow().getRunningFlows(current);
while(vFlows.next()){
//Check for the "Slack Change Pending Approval" workflow
if(vFlows.workflow_version.getDisplayValue() == 'Slack Change Pending Approval'){
//Cancel the workflow context
new Workflow().cancelContext(vFlows);
}
}}
var w = new Workflow();
var context = w.startFlow('1267b983136c72404562b0322244b05b', current, current.operation(), getVars());
function getVars() {
var vars = {};
for (var n in current.variables)
vars[n] = current.variables[n];
return vars;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 06:33 AM
I was trying to restart a request item workflow. This business rule seems to be just for the change request table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2017 08:54 AM
Did you get this working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2019 11:39 PM
Hi Josh, did you find a solution to this? I am also trying to also restart one workflow in a situation where there is 2 assigned to a change request both in cancel state.
Thanks