Before or After business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 10:48 AM
Hi,
There's a reference field on table 'A' which refers to table 'A' itself. It is a parent - child relationship.
Scenario: Record ABC - has a field 'owner' and has a child record XYZ. Both the records are from the same table. When 'owner' in ABC is changed, same should be reflected in the 'owner' of XYZ as well.
I am planning to write business rule on table 'A' which will trigger when the field 'owner' changes. It will run on update only.
The confusion is, how do I avoid 'current.update()' here?
Because whether it is a before or after BR, this code -> (current.child.owner = current.owner) is not working.
Any suggestions would be appreciated.
Regards,
Aishwarya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 10:56 AM
You need to gliderecord the child before updating. It should be an onAfter br and GlideRecord the the child record and then update the child record.
Is child a reference field on the table? Usually parent to child are 1 to many. So we gliderecord and use a while loop to update all the child records.
Please mark this response as correct or helpful if it assisted you with your question.