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
Rajkumar CV 10Rajkumar CV 10 

HTML Email templates.Help Needed

Hi All,

I have a scenario where i need to get a field(Notes_of_request__c) from Child object(Request) where the master is Case.
The Email template is in Case.
Where the case and requests are Master-detail, case is master and Detail is request.

How to get the field from child in Case Email templete, i mean in HTML templates.

Thanks in advance
Best Answer chosen by Rajkumar CV 10
vineet kumarvineet kumar
Rajkumar,

That is not possible in HTML Email Template.
Go for Visualforce email template.

Thanks.

All Answers

RajeshPunjabiRajeshPunjabi
Hi Raj,

Sorry didn't understand your question fully.

if you like to send HTML Email from Apex use HtmlValue parameter.


Here two (2) other solutions:

https://developer.salesforce.com/forums/?id=906F000000094ClIAI
https://developer.salesforce.com/forums/?id=906F00000008yUXIAY

I am sure above link will resolve your query.


Thanks
vineet kumarvineet kumar
Hi Rajkumar,

I am happy to let you know that  HTML Email Template does not support access to related object fields.

So if we want to access related object fields then we have to create Visualforce Email Templates.

Thanks.
Rajkumar CV 10Rajkumar CV 10
Hello ,
My question is I have two objects Case and Requests where Case is the parent and request is the child.
I have an email template for Case from which I need to get the value of a particular field from requests.
How to write merge fields code ?
RajeshPunjabiRajeshPunjabi
Hi Raj,

So you like you to use Request field in email template and should be able to do.

e.g. {!Account.Name} if you are in email template.

if using apex --> case.request__r.field name (make sure its in query)
 
Thanks
 
Rajkumar CV 10Rajkumar CV 10
Yeaaa tried it. But it is not working
vineet kumarvineet kumar
Rajkumar,

Which Email template you are using??
 
Rajkumar CV 10Rajkumar CV 10
HTML email template
RajeshPunjabiRajeshPunjabi
Are you using APEX? or from Template.
Rajkumar CV 10Rajkumar CV 10
HTML email template
Rajkumar CV 10Rajkumar CV 10
Not from Apex, from Template
vineet kumarvineet kumar
Rajkumar,

You are creating HTML Email Template on Case and want to get child object (Request) field that is not possible as of now.

So practice is to create Visualforce Email Template and there you can get child object (Request) fields.
RajeshPunjabiRajeshPunjabi
Ah, sorry missed your previous update. 

I have created custom object as  a child object of case and I am able to get field "{!Request__c.Case__c}".

Please verify you relationship configuration again.

Regards,
Raj

 
Rajkumar CV 10Rajkumar CV 10
Hello , The email template is in Case not in request. So I need to traverse from case not from request I mean from case to request
vineet kumarvineet kumar
Rajkumar,

That is not possible in HTML Email Template.
Go for Visualforce email template.

Thanks.
This was selected as the best answer
Rajkumar CV 10Rajkumar CV 10
Thanks Vineet