function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pranav_VaidyaPranav_Vaidya 

How to use records from detail/child table in email alert

Hi,

 

I have a master-detail relation on 2 custom objects. I have set-up an email alert on the parent object. I can access all the fields from the parent object while creating the email body. However the fields from child table are not accesible. I even tried to use the API code for the relevant fields, no luck.

 

How can I show the child records on an email alert.

 

for example, when the order email goes to the approver it has only Order header info such as total cost, supplier etc. How can I include the item details which are records from the child object.

 

Thanks.

Alok_NagarroAlok_Nagarro

Hi Pranav,

 

You cant access child object fields while setting up email alert(standard way) on parent object. There are two ways to do same:

 

1. If you want to use standard email alert functionality (i.e. workflow..etc), then setup email alert on child object instead of parent object and you will bw able to access child object fields as well as parent object fields.

2. Use apex code: trigger - Using apex u can query parent to child and can access both object fields and send mail as well.