How setworkflow method work in BR

GofortP
Giga Contributor

Hi,
I want to know how setworkflow(false) work in BR. Do we have to write after the logic or between the logic.

4 REPLIES 4

G Ponsekar
Mega Guru

Hi @GofortP ,

 

setWorkflow(false) will stop business rules & workflows from running.

You can use it at end but before gr.insert() or gr.update() statement

 

Please mark correct if it is helpful to you

 

Thanks,

GP

Ankur Bawiskar
Tera Patron
Tera Patron

@GofortP 

you need to write setWorkflow(false) just before either of these lines as per your requirement gr.insert() or gr.update() or gr.query().

It will disable the business rules on that table after insert, update or during query

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

AA  ....... Sasur  Galat haii answer  apka  app samajh naahi paye 

J Siva
Tera Sage

Hi @GofortP 
Typically, setWorkflow(false) is called before performing any database operations such as create, update, or delete. So that, it will not trigger any other workflows or business rules.

 

So in your BR, you can write that before the insert(), update() or delete() operation.
Regards,
Siva