- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:02 AM
Hello,
I am running a script background for updating some cases, this triggers a business rule that send mail to users, to prevent that i use the method setWorkflow(false)
should I set the workflow back to true after ? what happened if I don't ?
thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:42 AM
@ammar_k The setWorkflow(false) prevents business rules/flows/workflows from running. It is not needed to set the setWorkflow to true afterwords.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:13 AM - edited 04-04-2025 02:18 AM
Hi @ammar_k ,
it's setWorkflow(false)
should I set the workflow back to true after ? what happened if I don't ?
since it's a background script that you are running there is no action for you to take
you can review this below KB to get complete understanding of what setWorkflow(false) does when set it
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:32 AM
Hello @Chaitanya ILCR ,
Below are some details,
1. What is SetWorkflow(false) :
In ServiceNow, setWorkflow(false) is a method used to suppress business rules and workflows from being triggered when a GlideRecord operation (like insert(), update(), or delete()) is performed.
2. Do you need to set it back to true?
No, you don't need to reset it to true. The setWorkflow(false) call only affects that specific GlideRecord instance and only during that transaction. It does not persist or affect other records or future executions.
So you don’t have to worry about something like:
gr.setWorkflow(true); // Not required
Thank,
Valmik Patil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:42 AM
@ammar_k The setWorkflow(false) prevents business rules/flows/workflows from running. It is not needed to set the setWorkflow to true afterwords.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 03:19 AM
just before the update() method you need to use setWorkflow(false) so that stops business rule, flow, workflows, notifications from triggering
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader