1

Let's say a parent object Parent__c and a child object Child__c, now I have a lookup field in the Child__c, (for ex: Parent_Field__c) which links to Parent__c.

Now I already have a trigger written on the Child__c, to do some operation that uses a field(for ex: Test_Field__c) from Parent__c and after finishing that operation it updates the child record with the return value.

But now the situation is that I need to do the same operation when the Test_Field__c on Parent__c gets updated.

At present, I know that I can write a trigger on the Parent__c object to do this operation.

But I want to know if it is possible to do that from the Child__c object's trigger without writing any trigger on the Parent__c object. I just want to be sure if there is any salesforce documentation or workaround or anything that I am missing.

1 Answer 1

0

You can use a Flow or Process Builder to automatically update the child records when the parent field changes. This will cause the child triggers to be called recursively. In this way, you would need no code to keep the child records updated. Make sure the Flow/Process Builder doesn't do an unnecessary update, or you might end up with an infinite loop.

2
  • is there any apex code only solution?
    – Smaranjit
    Commented Nov 3, 2021 at 16:35
  • @Smaranjit Triggers only run when some feature forces an update. From child to parent, you can use things like Rollup Summary Fields, but from parent to child, you must do something, either a trigger, PB, or Flow.
    – sfdcfox
    Commented Nov 3, 2021 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .