Restarting workflow that was completed

AshwinV
Tera Contributor

Hi,

 

Restarting a workflow is creating a new workflow context is this a  expected behavior.

 Scenario is that request item was completed(workflow also completed) and workflow was updated. After which the request was reopened again which caused both old version and new version workflow to run at same time creating 2 workflow context to run. Is this a expected behavior, if not how to avoid this scenario.

3 REPLIES 3

Community Alums
Not applicable

Aman Kumar S
Kilo Patron

Hi @AshwinV ,

Find the details in belwo servicenow supprot doc:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713154

Best Regards
Aman Kumar

Harish KM
Kilo Patron
Kilo Patron

Hello another way is to cancel the existing workflow and to trigger a new one

sample script below

var wf = new GlideRecord("tablename");
wf.get('sys_id of the record');
var oldwf = new Workflow();
oldwf.cancel(wf);
var newwf = new Workflow();
newwf.startFlow(new Workflow().getWorkflowName('workflowname',wf,'');

Regards
Harish