You need to sign in to do that
Don't have an account?
Can't get value from Merge field when use Email Templete
Hi,
I have a custom object as "A__c". And I create a trigger when I update this object record. This trigger will send mail to some users.
Then I create an email visualforce template. And let my trigger invoke this template when I send mail.
But I met a problem about the template.
I set the recipientType as "User", and relatedToType as my custom object "A__c"
<messaging:emailTemplate subject="Assign Audit" recipientType="User" relatedToType="A__c"> <messaging:plainTextEmailBody > Hello {!recipient.name} This is {!relatedTo.Name} </messaging:plainTextEmailBody> </messaging:emailTemplate>
When I use "Send Test and Verify Merge Fileds",assign an user and an "A" record, I can see the corresponding value display on this mail body.
But if I update a record then the trigger run and invoke this template, the {!recipient.name} can get value and display, but {!relatedTo.Name} can't get any value.
So does anyone meet this problem before? Or whether I have some wrong code at this template.
Thank you!
I understand what problem with my template.
I need to set the record id for my merge field in that email template.
In my trigger :
And a is my A__c instance.
Then my template can get the corresponding values