After business rule is not running when a field is auto updated by the system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 01:39 AM
Hello,
I have a field "A" that must be updated when the value of the field "B" is updated (both fields are in the same table), to do this I created an after business rule that runs each time the field "B" is updated and it puts the needed value for the field "A".
When I test updating the value of the field "B" directly in the form, it works and the field "A" is updated also but when the field "B" is automatically updated by the system, the field "A" is not updated..
I thought that maybe there's a setworkflow(false) in the OOB script that updates the field "B" but even when I changed my business rule from after to asynch it didn't work.
Do you have an idea on how to resolve this?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 04:13 AM
Thank you for the screen shots, that help a lot.
So a few pointers here.
You have no conditions on when this business rule should run, but in the script, you first check if the current target is a resolution target.
I would put that into the conditions on when the BR should run.
The business rule runs on insert, which seems unneccessary, no SLA should be breached when created, right?
You can optimize the query on the customerservice table by some small changes, like so:
var grCase = new GlideRecord('sn_customerservice_standard_case');
if (grCase.get(current.getValue('task')){
// your logic here
}
And finally (and most important) in the current script, you run a current.update().
Since there are no conditions (at the moment) present in the BR, the current.update() will call this business rule again and again and again (infinite loop), because the trigger is to run on every update. So this could also cause some trouble.
Start with these things, and lets see what happens next.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 05:06 AM
Thank you for your help, I've updated the BR in order to run on update, and when the "Has breached" field changes and the SLA definition target is "Resolution", I've optimized also the script.
For the test when I updated the "Has breached" field by a background script and with the setWorkflow(false), the value of the other field wasn't updated but when I commented the setWorkflow(false) it worked fine, that's why I said that the update done by the system disables all the other business rules.
Since I don't think that it's a good idea to change the OOB process for updating the field "Has breached" in the table "task_sla", I'm thinking about having a scheduled job that runs daily on table "task_sla" and that will update the value of the needed field based on the value of the field "Has breached" when the conditions are met.
For this solution, I'm worried that it will cause maybe some performance issues, what do you think about it ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2023 12:38 AM
I can't see how doing this as a scheduled job (or a Flow) that runs daily would impact performance.
The upside is that you can have it run on off-business-hours, so impact should be minimal.
The downside is that the values doesn't reflect in realtime the breached SLAs, so reporting would be a bit off.
If you are going down this path, you can use update multiple to further reduce processing, instead of updating one record at a time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 01:28 AM
Hello Olan,
Yes, finally I've followed this path to resolve the issue, thank you for being so helpful.