Ravi Chandra_K
Kilo Patron
Kilo Patron

setWorkflow(false)

most of the developers very well aware that setWorkflow(false) stops Business Rules and developers often use it with combination of current.update() to prevent Business Rules that might normally be triggered by subsequent actions.

 

However, setWorkflow(false) actually has a broader impact on the instance than just stopping Business Rules. It affects the following functionalities as well:
  1. It doesn't work on Async Business Rule ( KB0863492 ) 
  2. effect on Audit (KB0869538)
  3. effect on Journal fields (KB0867584)
  4. effect on SLA engines (KB0598456)
  5. effect on Notification Engine (KB0858407)
  6. effect on scope applications (it works but RCA has to be allowed: KB0820691)
  7. effect on Workflow and Flow Engines and more. (KB0960053 

Would using setWorkflow(false) stop Workflows/Flows?

sometime back, I come across this interesting thread which discusses the effect of setworkflow(false) on flows.

Using setWorkflow(false) doesn't stop Flow Designer flows from executing?

the thread has mixed answers. while in some cases it stops, in some cases it doesn't.

 

ServiceNow has addressed this by introducing a system property to control the effect of setWorkflow(false) on Workflows/Flows. 

property name: trigger_engine.ignore.set_workflow. (this is a boolean true/false property)

By default, the flows and workflows will not stop when setWorkflow(false) is used. this behavior was noticed somewhere post Tokyo. (I do not find this property in the latest instance, this must have been hardcoded).

if the above property is set to false, then flows and workflows will stop executing in that transaction. 

this is a system wide property, it will have impact all the workflows/flows associated with setWorkflow(false).

 

Conclusion:

From an Implementation point of view, the use cases/requirements of stopping flows and workflows are quite rare in general. 

However, it's important to be mindful of all the impacts of setWorkflow(false). even if the use case is just to stop subsequent business rules, it's good practice to cross verify all the subsequent business rules and other functionalities on the table it may impact. 

 

I will keep updating this article with community threads/support articles regarding setWorkflow(false).

please feel free to add your observations and behavior about setWorkflow(false) as comments.

 

Thank you for reading 🙂

Please mark it as helpful and share the article if you find it helpful!

Kind Regards,

Ravi Chandra.

 

Comments
Ravi Chandra_K
Kilo Patron
Kilo Patron

The reference for the system property can be found in the below support article:

Creating an event to trigger flow is not working 

 

 

Kind Regards,

Ravi Chandra.

Version history
Last update:
‎12-07-2024 06:31 AM
Updated by:
Contributors