Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Before or After business rule?

Aishwarya59
Tera Contributor

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

 

1 REPLY 1

SanjivMeher
Mega Patron
Mega Patron

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.