- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 09:20 AM
HI All,
I have a customized business rule from some SLA will get cancelled, But However the cancelled SLA's clock is not stopping, because cancelled SLA's workflow are in stil progress.
So i need to cancel the workflow from my business rule.
Please find the BR rule some code which is not cancelling the SLA workflow:
kindly provide your input to how i can change my code to cancel the default sla workflow.
Regards,
Saddam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 10:37 AM
Hi Saddam,
In your case current is task_sla record. So please try
var workflow = new Workflow();
workflow.cancel(task_sla_gr);
Also remove the line of code related to task_sla_gr.setWorkflow(false);
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 09:35 AM
Hi,
You can cancel a workflow using the following line of code: new Workflow().cancel(current);
Please refer
https://wiki.servicenow.com/index.php?title=Workflow_Script#cancel.28record.29
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 09:39 AM
Hi Saddam,
setWorkflow(false) is used to skip running business rules during a gliderecord update.
instead try:
var workflow = new Workflow();
workflow.cancel(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 10:27 AM
Thanks Harel & Alikutty
I'm writing business rule on incident table and cancelling sla workflow based on condition.
However i tried with :
var workflow = new Workflow();
workflow.cancel(current);
which is not cancelling the workflow.
kindly suggest.
Regards,
Saddam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 10:37 AM
Hi Saddam,
In your case current is task_sla record. So please try
var workflow = new Workflow();
workflow.cancel(task_sla_gr);
Also remove the line of code related to task_sla_gr.setWorkflow(false);
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response