How to disable other business rule that might run.

Tadz
Tera Guru
Tera Guru

Hi, how do we   disable other business rule that might run.

My initial approach is to use setWorkflow(false); But I don't know if its right

Does set workflow runs only in workflows?

Thanks,

Tadz

1 ACCEPTED SOLUTION

sumeet_n
Kilo Guru

I did try to use setWorkflow(false) yesterday. It does stop the BR execution on target record but it didnt execute the update() in the current BR as well. Below is the gist of what I was trying to achieve.



How to kill a BR running in loop?



I am still looking for the exact behaviour of setWorkflow(false)... I have also referred wiki for the same.


View solution in original post

6 REPLIES 6

Gurpreet07
Mega Sage

No its not. Its a function of GlideRecord class and it will skip execution of business rules while you perform any operation(insert/update) with that glideRecord object.


sumeet_n
Kilo Guru

I did try to use setWorkflow(false) yesterday. It does stop the BR execution on target record but it didnt execute the update() in the current BR as well. Below is the gist of what I was trying to achieve.



How to kill a BR running in loop?



I am still looking for the exact behaviour of setWorkflow(false)... I have also referred wiki for the same.


Hi Sumeet, I followed your implementation.



if(!current.work_notes.getJournalEntry(-1).split("\n\n")[0].indexOf('Work notes on '))



Let me know if you have better implementation on this.



Thanks and Best Regards!


Tadz


Gurpreet07
Mega Sage

Have a look at section 10.12 from below link


GlideRecord - ServiceNow Wiki