The CreatorCon Call for Content is officially open! Get started here.

setWorkflow(false) use in business rule

VullankiL
Tera Contributor

Hi 

I have one scenario, where I am using setWorkflow(false).

 

VullankiL_0-1736767804068.png

 

But in my case, there is no workflow associated with the table. But I want to stop executing remaining business rules associated with it. (Because there is another business rule that can abort this cancel action) Can I use it or not? Is there is any other option to stop execution of other business rules in this case?

Thank you

17 REPLIES 17

Hi @Runjay Patel , 
Thank you for the reply
Then how can I stop executing the business rule in another scope. Is there any solution for it?

 

Hi @VullankiL ,

 

You need to write the BR in same scop.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Ankur Bawiskar
Tera Patron
Tera Patron

@VullankiL 

if you use setWorkflow(false) then BR, flows, notifications won't trigger on record update

Now whether it has to be used or not depends on requirement.

Example: consider you want to update all incidents and add some comments from background script, you will use setWorkflow(false) to avoid subsequent BRs, notifications from triggering

but in your case since you told there is a BR which can cancel then don't use setWorkflow(false), if the BR condition doesn't satisfy it will allow update as per your defined functionality.

If the BR condition satisifies then it will stop that action as per your customer requirement

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur ,
Even after using setWorkflow(false) in my business rule, it is executing another business rule (to abort cancel action). I don't want to execute it.
I am writing the current business rule for Assessment instances table (Global scope). But the updating record is in another scope (scoped). And setWorkflow(false) showing some security constraints. How can I solve it? please let me know..

Thank you,

@VullankiL 

setWorkflow(false) can only abort for same scope table and not for other.

Why not create BR on Assessment instances table (Global scope) in your scope and then abort if required?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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