- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 09:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 10:22 AM
Hello @Shaik22 ,
Please find below the script for starting and cancelling the workflow.
1) Start the workflow
var gr = new GlideRecord('your_table');
gr.initialize();
gr.insert();
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert');
2) Stop/Cancel the workflow
var workflow = new Workflow(); //cancel all the workflows, where current is a task record with a workflow context
workflow.cancel(current);
gs.addInfoMessage(gs.getMessage("Workflows for {0} have been cancelled", current.getDisplayValue()));
Mark this as helpful if it is
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 10:22 AM
Hello @Shaik22 ,
Please find below the script for starting and cancelling the workflow.
1) Start the workflow
var gr = new GlideRecord('your_table');
gr.initialize();
gr.insert();
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert');
2) Stop/Cancel the workflow
var workflow = new Workflow(); //cancel all the workflows, where current is a task record with a workflow context
workflow.cancel(current);
gs.addInfoMessage(gs.getMessage("Workflows for {0} have been cancelled", current.getDisplayValue()));
Mark this as helpful if it is
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 10:27 AM
Hi @Shaik22,
Take a look at ServiceNow product to start, cancel or stop the workflow using scripts.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar