You need to sign in to do that
Don't have an account?
Girbson Bijou
Update child in Self relationship when parent is update
I want to update some field child with the same value of the parent anytime the parent is updated. With this below code, it fire only when a record is create. But it does not update the field on child when the parent is update. I remind that , the contition to just update it i
s when NewOut.Housing_If_Sanitation__c !=NULL
trigger AutoOutput on Output__c (after insert, after update) { if(Trigger.isInsert){ List<Output__c> Output = new List<Output__c>(); for (Output__c NewOut : Trigger.New) { if ( NewOut.Project_Type__c =='House'&& NewOut.Housing_If_Sanitation__c==NULL) { Output__c OutputChild = new Output__c(); OutputChild.Housing_If_Sanitation__c= NewOut.Id; OutputChild.Project_Type__c = 'Sanitition'; OutputChild.RecordTypeId=NewOut.RecordTypeId; OutputChild.Description__c=NewOut.Description__c; OutputChild.Locality__c=NewOut.Locality__c; OutputChild.Milestone__c= NewOut.Milestone__c; OutputChild.Address__c = NewOut.Address__c; OutputChild.claust__c=NewOut.claust__c; OutputChild.A__c=NewOut.A__c; OutputChild.Besem__c = NewOut.Besem__c; Output.add(OutputChild); } } upsert Output; } }
s when NewOut.Housing_If_Sanitation__c !=NULL
If your formula evaluates to House for the child, then you've created an infinite loop. This error is indicative of a typical infinite loop. However, without knowing how the formula operates, no way to tell your intent. You might want to check if the parent field is already populated or check some other condition, or you might need to adjust your formula's behavior, or some combination thereof.
Hope this helps.
Thanks,
Nagendra