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
Peter Martensen 8Peter Martensen 8 

Can I use data from an Opportunity linked to a custom Object Record on a HTML email template?

I have a custom Object (Market_Intelligence_Reports__c) that has a lookup field to Opportunities.  I would like to use data from the Opportunity in a HTML email template.  I can't use a VF template because I need to use the template in an Activity Email from the Market Intelligence Reports record.  Is there a way to use the Opportunity data in the template?  I've tried things like
{!Market_Intelligence_Reports__c.Opportunity__r.Account.Name}, {!Opportunity__r.Account.Name}, {!Market_Intelligence_Reports__c.Opportunity__r.Account}
Thanks
ShirishaShirisha (Salesforce Developers) 
Hi Peter,

Greetings!

Cross-Object Email Template is not Possible in salesforce at this point in time It's an idea (https://success.salesforce.com/ideaView?id=08730000000Brk7AAC), you can also upvote it.

You can't access or use the values of any related object in email templates, you might have to create formula field to bring down the value from parent to the object on which the email template is target.

You can access and display child record details in the email template of a parent is to use Visualforce Email Templates.

https://salesforce.stackexchange.com/questions/95408/access-child-objects-fields-in-visualforce-email-template

http://www.infallibletechie.com/2013/05/visualforce-email-template-with-custom.html

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
 
Peter Martensen 8Peter Martensen 8
Shirisha,
I discovered that converting the Opportunity Lookup field to a Master-Detail field enabled the template to access the cross Object data.
Peter