You need to sign in to do that
Don't have an account?

Trigger on parent to update Child record if parent = value
Hello,
Was hoping for a bit of help with the below parent child trigger
Parent is ADR
CHILD is ADRUser
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;
}
Was hoping for a bit of help with the below parent child trigger
Parent is ADR
CHILD is ADRUser
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;
}
http://stackoverflow.com/questions/8671504/fire-a-update-trigger-when-particular-field-is-updated