I have a issue to get user's FirstName or Name in the Visualforce email template. This is my code:
<messaging:emailTemplate subject="{!$Label.some_Subject}"
recipientType="User"
relatedToType="User"
language="{!recipient.LanguageLocaleKey}" >
<messaging:htmlEmailBody >
The following methods do work:
{!recipient.FirstName} , {!recipient.Name}, {!recipient.name}
{!relatedTo.FirstName}, {!relatedTo.Name}, {!relatedTo.name}
{!recipient.LanguageLocaleKey}
{!User__c.name}
Does anyone has any suggestions to solve the issue?
I found old link "visualforce email template not resolving recipient and relatedTo at runtime (WhoID, WhatID)
AddThis Sharing Buttons
Share to TwitterShare to Google+Share to FacebookShare to LinkedIn"
https://developer.salesforce.com/forums/?id=906F0000000952jIAA
https://success.salesforce.com/issues_view?id=a1p30000000SdBfAAK
Or people has to to this way? Using Custom Controllers within Visualforce Email Templates - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_templates_with_apex.htm
Thanks!
Eric
But I coudl not find the solution.
답변 2개
Hi Perumalsamy,
Yes, it works in above setting. Since we still need to get !recipient.Username so we can not this field with Contact unless we can create a lookup filed in Contact, for instance "User_UserName".
Thanks!
Eric