current.setworkflow

J_31
Kilo Sage

Hello 

I want to update the current record using async business rule/after

I read that I must use 

current.update()

current.setWorkFlow(False);

Can someone help what is happening behind when we set the workflow to false?

Thanks 

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

When you call current.setWorkFlow(false) you would want to call that before you call current.update(). 

This method will prevent additional business rules from firing against the current record based on the update you are about to perform. This is used to "end" the business rule processing stack and to prevent your update from triggering a circular round of updates that might otherwise result in a never-ending loop(recursive loop). 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

4 REPLIES 4

Michael Jones -
Giga Sage

When you call current.setWorkFlow(false) you would want to call that before you call current.update(). 

This method will prevent additional business rules from firing against the current record based on the update you are about to perform. This is used to "end" the business rule processing stack and to prevent your update from triggering a circular round of updates that might otherwise result in a never-ending loop(recursive loop). 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Many thanks for quick response!

Anshu_Anand_
Kilo Sage
Kilo Sage

The serWorkflow() method accepts one argument: a boolean true/false value. This argument will determine whether business rules should be triggered by any database actions performed by your GlideRecord script. For example, if you make a change and call the update() method, calling setWorkflow() and passing in false will prevent any business rules that would normally be triggered by that update from running.

Regards,
Anshu

Many thanks for quick response!