Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 07:18 AM
Hello i am creating a business rule that when triggered it stops the current workflow and will start a different workflow. Any ideas on how to achieve this? Thanks.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 07:25 AM
Hi
To start a new workflow and attach to the ticket
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert'); //gr is the record
To cancel the workflow
var w = new Workflow();
var gr = new GlideRecord(‘wf_context’);
if (gr.get(current.context)) // current is the record here
w.cancelContext(gr);
-Anurag
-Anurag
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 08:15 AM
Any specific reason to post the same script which I shared?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader