You need to sign in to do that
Don't have an account?
fredka
Getting Name of Parent From Child before update trigger
I have a parent child relationship... on the before update of the child record, I wasn to write the name of the child to include the parent name... here is what I have but the parent name portion is shown as null
for (Health_Enrollment_Product_Detail__c HEPD: Trigger.new){ //Set the name of the health_enrollment_product_detail object HEPD.name = HEPD.Health_Enrollment_Summary__r.name + ' ' + HEPD.Product__c + ' ' + HEPD.Funding_Type__c; }
Thanks!!
trigger parentName on Child__c (before insert, before update)
{
for (Child__c child: Trigger.new)
{
if(Trigger.isInsert)
{
Account a = Database.query('select name from Account where id=\''+ child.parent__c + '\'');
child.parent_s_name__c = a.name;
}
}
}
I created a master-detail (parent child) between "Account" standard and "Child" custom object fo rthe above example to work.
Thanks for responding Aish!!!