0

I'm editing a Visualforce Email Template whose sending is triggered by automation (process builder) that starts with the creation of an Attendee object that meets certain criteria. The Attendee object is the child of an Event parent object and I would like to populate merge fields in the email with data from the Event parent object, but I'm not sure the best way to do that.

I have tried just assigning the Event object as my "relatedToType" in the Visualforce Email Template code, but that doesn't seem to be enough to specify the correct record when I actually test the email outside of the "Send Test and Verify Merge Fields" when I am able to select the "Related To Record" manually. The Attendee object does have an Event field that contains the 15-character ID of the parent record. Assuming that's the correct way to go, how can I use the identity of the parent object (the Event) so that I can use its information in the merge fields?

  • My sense is that I need to utilize the format 'Child__c.ParentId__r' for the Parent__c objects...I'm just not sure how to get the Id of the Parent in there from the Attendee Child record. – bblohowiak Nov 29 '16 at 18:53
0

After some trial and error, here is the gist of the code that ended up working. It turns out that I didn't need to specify the 15-digit ID of the parent object; I just had to be strategic about where I placed my "r." Attendee was the child object and Event was its parent; Display Name was a field on Event.

<messaging:emailTemplate subject="You Are Registered!" recipientType="Contact" relatedToType="EventApi__Attendee__c"   >

Hello! Thank you for registering for our {!relatedTo.EventApi__Event__r.EventApi__Display_Name__c}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.