You need to sign in to do that
Don't have an account?
SFDC@Error
Update Parent based on related Child record
Hi All
How can i update parent based on related child.I have 2 object Contact and Boutique__c.
Contact is Parent and Boutique is child.
Chilld object has one picklist field with value HOT,COLD and Others.
Need to update this value in parent object.Means if i am creating one child with picklist value HOT then it will update the parent HOT
If i am creating another record with COLD vlaue it will update COLD.Like this....I have created a trigger but its working only one child record .
How can i update parent based on related child.I have 2 object Contact and Boutique__c.
Contact is Parent and Boutique is child.
Chilld object has one picklist field with value HOT,COLD and Others.
Need to update this value in parent object.Means if i am creating one child with picklist value HOT then it will update the parent HOT
If i am creating another record with COLD vlaue it will update COLD.Like this....I have created a trigger but its working only one child record .
trigger UpdateContact on Boutique__c (after insert, after update) { List <contact> OppList = new List<contact>(); for(Boutique__c DDL : Trigger.new){ contact oppty=new contact(id=DDL.Customer_Name__c,Contact_Type__c=DDL.Visit_Type__c); OppList.add(oppty); } try{ update OppList; }catch(DmlException de ){ System.debug(de); } }
Eg., if contct name is John Doe entered and then if someone enters 3 records of Boutique__c with HOT, HOT, and COLD then John Doe should have "COLD" as in his picklist value.
Let me know if this is the behavior you are looking for?