- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 10:52 AM
I have two tables where each has a reference to the other. I have created two Business Rules. One for table 1 that updates it's reference field in table 2. One for table 2 that updates it's reference field in table 1.
This causes both Business Rules to be called whenever a reference field change is made to either table. This is because each updates the reference field on the other table. Both Business Rules are triggered "after" "insert/update" of reference field.
I have logic to prevent unnecessary updates but there is still some overhead (insignificant probably...).
I am wondering if this is a situation that is avoidable or is it a somewhat common occurrence?
I hope my post is not too confusing. If so, I will try to clarify further.
Thanks.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 06:41 PM
Great! There's really no overhead in place with the approach you're taking. So you should be fine since the field only gets updated once at both tables.
Lets elaborate why:
By the time the on after business rule of the second table is executed, the value that it will attempt to change for the first table that initiated the change will be ignored since now the value will be the same at both tables. That's because within any glide record, at least one value has to be different in order for an .update() to be effective. Except when setForceUpdate is set to true for the glide record.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 11:05 AM
Hi Bryan,
Do you have a condition within your business rules so these are fired only when the field's value changes?
Thanks.
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 11:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 06:41 PM
Great! There's really no overhead in place with the approach you're taking. So you should be fine since the field only gets updated once at both tables.
Lets elaborate why:
By the time the on after business rule of the second table is executed, the value that it will attempt to change for the first table that initiated the change will be ignored since now the value will be the same at both tables. That's because within any glide record, at least one value has to be different in order for an .update() to be effective. Except when setForceUpdate is set to true for the glide record.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 06:04 AM
Thanks for the clarification. Just one more question. Regarding the statement "at least one value has to be different in order for an .update() to be effective". Does this mean that a value check of the field being updated in the script is unnecessary - i.e. if (currentvalue != new value)?