- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 05:58 AM
In my business rule I have used current.update() and it works as expected but it throws the recursive BR error during the validation check. Tried using setWorkFlow(false) after the update statement but still of no avail. So wanted to know if there's any other subsitution to fix this error.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 06:24 AM - edited ‎03-01-2024 06:27 AM
Hi @SounakPal,
Firstly, as I'm sure you've read and have been directed, avoid using current.update() - It is against best practice for this very reason you're experiencing.
I know SN's docs and Best Practices advise you can prevent recursive Business Rules by using the setWorkflow() method with the false parameter, "current.setWorkFlow(false)" - it also states this should only be used under special circumstances. My recommendation - it should still be avoided.
Depending on your logic, can you change the business rule to a 'before' business rule and remove the current.update()?
Please try this.
If you share you're code (high level), there may be another solution available (depending on what you're trying to achieve)
But to answer your question directly - do not use current.update() in an after business rule. Change the Business Rule ('BR') to a before 'BR' and remove the current.update() statement.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 06:24 AM - edited ‎03-01-2024 06:27 AM
Hi @SounakPal,
Firstly, as I'm sure you've read and have been directed, avoid using current.update() - It is against best practice for this very reason you're experiencing.
I know SN's docs and Best Practices advise you can prevent recursive Business Rules by using the setWorkflow() method with the false parameter, "current.setWorkFlow(false)" - it also states this should only be used under special circumstances. My recommendation - it should still be avoided.
Depending on your logic, can you change the business rule to a 'before' business rule and remove the current.update()?
Please try this.
If you share you're code (high level), there may be another solution available (depending on what you're trying to achieve)
But to answer your question directly - do not use current.update() in an after business rule. Change the Business Rule ('BR') to a before 'BR' and remove the current.update() statement.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 06:56 AM
Hi Robbie thank you for the recommendation. I'll change the run condition accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 07:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 06:26 AM
is there any reason why your BR cant be used before ? and without the current.update?