+ Start a Discussion
Bryan Revelant 7Bryan Revelant 7 

Trigger on parent to update Child record if parent = value


Was hoping for a bit of help with the below parent child trigger

Parent is ADR

The below trigger works but, I want add some additional logic. If parent record Next_Step__c = submit then update the child ADRUser__c = Submit else do nothing. 

My SOQL is on the child record and my trigger on the parent. 

Help on the below?

trigger ADRParentUpdateChild on ADR__c ( after update, after insert) {
List<ADRUser__c > childRecords = [Select ADR__c, Status__c FROM ADRUser__c WHERE ADR__c IN :Trigger.newMap.keySet()];
        for(ADRUser__c child :childRecords){
            if(child.Status__c == null){
                child.Status__c = 'Submit';
        if(childRecords.size() > 0)
            update childRecords;
Hi, I assume you are looking out for a way where you want this trigger to execute only on one particular field change and not on others. The below post might help

Bryan Revelant 7Bryan Revelant 7
If a parent value = some string update all child records with that value. Not really at a granular level