+ Start a Discussion

Email merge fields not working across relationships

I'm sending a text email with a custom object, ObjectX__c, as the related to object, from a Workflow rule. I'd like to include some information from a parent lookup contact, ObjectY__c, in this email. I also have ANOTHER parent lookup contact, ObjectZ__c on ObjectX__c.


I was thinking I could use this syntax:




or maybe


{!ObjectX__c.ObjectY__r.fieldname__c} (note the __r instead of __c)


Neither works. Both just result in a blank. The odd thing is, if I do merely




I get the contact name for the related ObjectY__c as I would expect.


Any ideas?




    I had faced similar issue.  After that I realized that email templates cannot refer fields from Parent Objects.


The workaround would be to create new cross-object formula fields in ObjectX__c that will essentially refer the fields from parent object which you want to send in email template. And in email template, use these new fields.


E.g. You want to refer FieldA in parent object ObjectY__c.


Create formula field F_FieldX__c with formula ObjectY__r.FieldA;


Use F_FieldX__c in your email template.


Repeat the same in other Parent objects.


Hope this helps



Is is possible that that cross object formula wouldn't update/populate before the workflow rule fires?  The merge fields we are using are cross object formula fields on the object with the workflow rule, and they are working in some instances and blanks in other tests.  The WF rule is clearly firing and the merge fields are correct in the template.