How to stop running workflow?

ak4
Tera Contributor

How to stop running workflow?

10 REPLIES 10

Hi @Ankur Bawiskar , 

The background script is not working for me in Prod. Can you please tell if I need to modify something here.

var gr = new GlideRecord('sc_req_item');
gr.get('69a41e39db96051071310661f39619c9'); //ritm sys_id

var workflow = new Workflow();

workflow.cancel(gr);

Hi @sbeginner , If you are looking for cancelling the workflow, you can just cancel the workflow context that is 'Executing'. It will cancel the activity. You can see in this thread on how to cancel it without script by using Cancel Ui action on the context form.

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023

DirkRedeker
Mega Sage

Hi

You do not need to go the hard way through code.

Just navigate to Workflow Contexts, and open the Context of the Workflow you want to cancel.

Then, click on "Cancel", like shown in the screenshot below:

find_real_file.png

Let me know if that answers your question and mark my answer as correct and helpful.

BR

Dirk 

Hi

Do you have some update on this?

BR

Dirk

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Hope you are doing good.

Let me know if that answered your question.

If so, please mark appropriate answer as correct & helpful to close the thread.

If not, please let us know if you need some more assistance.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader