You need to sign in to do that
Don't have an account?
EmailTemplate not translated
Hi,
i've Registration object from which i want to send an email template to the Contact related to the Registration.
My email needs to be in the language of the Contact (French, Dutch, English) so i use this
<messaging:emailTemplate subject="Confirmation Registration" recipientType="Contact" relatedToType="Registration__c" language="{!recipient.language_email__c}">
<messaging:htmlEmailBody >
<html>
<body height="100%" width="100%">
{!$Label.Dear}<br /><br />
...
My $Labels are translated in the 3 needed languages.
The email is sent based on a change of status of the Registration.
If i use the "Send Test and Verify Merge Fields" button of the EmailTemplate with the corresponding Registration and Contact, it works fine.
However if change this status in Apex or on the Registration record itself, the mail is always sent in English.
Any idea why it doesn't work otherwise ?
Thanks for your help
if recipient.email is null ,it will automatically be "English".Make sure that recipient.email is not null
it's the case. There is a value in the email language.
But i'm not sure of the format. I tried "FR", "fr" , "fr-fr", "fr-BE" but nothing works (except with the Send Test button)
Ced
My mistake, i didn't check fully :(
Indeed if i debug the value of the recipient.email, it is null (the recipient.Id too).
But i don't understand anyway why the recipient is null.
I've a trigger before insert to add the Contact or link an existing Contact to my registration (with an email in the Contact).
My Registration contains a field named Contact (Contact__c) which is a lookup to Contact object.
after having inserted the Registration and its children Registrations, i change his status to "Send Confirmation Email" which fires a workflow rule with the Email Alert including this Email Template. In the config of the Email Alert, i've the Recipients = Related Contact: Contact.
In <messaging:emailTemplate subject="Confirmation Registration" recipientType="Contact" relatedToType="Registration__c" language="{!recipient.language_email__c}">
how does it make the link between the Recipients of the config and the {!recipient}. Am i missing a parameter or a config somewhere ?
Thanks
Moreover if the recipient.email is null, how is it possible that i receive the email ?
Ced
One workaround is to create on Registration object a formula to Contact.language_email__c and to use it in language parameter of the emailTemplate
<messaging:emailTemplate subject="Confirmation Registration" recipientType="Contact" relatedToType="Registration__c" language="{!relatedTo.language_email__c}">
Not very clean but it's working.
If somebody has a clean solution, please share it :-)
Thanks