0

In my use case, I have 2 objects called 'Object A' and 'Object B'. 'Object B' contains a master-detail relationship to Object A. I have an email alert which has been set up on 'Object A'. In the corresponding email template is as below and it is working fine.

Hi {!ObjectA__c.OwnerFirstName},

Congratulations! Your request is approved by. Please proceed with completing your classes and we wish you the all the best.

My current requirement is that I need to merge child object field into this email. So that I have added {!ObjectB__c.Status__c} as folllows.

Hi {!ObjectA__c.OwnerFirstName},

Congratulations! Your request is approved by
{!ObjectB__c.Status__c}
. Please proceed with completing your classes and we wish you the all the best.

But it is not working. Appreciate if someone can help me out regarding this conern

1 Answer 1

2

There are a couple of things here - your Email Alert is based on the parent, Object A. So it wouldn't be able to reference Object B records like that because it wouldn't know which child record you were referring to.

However, cross object merge fields aren't currently supported - see this: https://developer.salesforce.com/forums/?id=9062I000000g7bmQAA

Normal workaround is to put a formula field onto your primary object that pulls the info you need from the related objects, and then reference that in your email template. But again - think about whether you want your primary object to be on your parent or child object - in your case I would be making the child object the primary object of the email alert.

2
  • Currently these email alerts are firing through a process builder which has been set on Object A. As per your comment, if I am setting email alert on Object B and doing changes accordingly, do I have to set the process builder on Object B? Summarizingly, the object of email alerts and the process builder should be the same? Mar 7, 2021 at 16:59
  • 1
    Yes, process builder will pass the triggering record through to the email alert, so it should be triggered from Object B.
    – edralph
    Mar 7, 2021 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .