in here issue details:

Context: In our system we are sending Welcome Emails using the method System.resetPasswordWithEmailTemplate to customers in our Experience Cloud (community). When we tried to use relatedTo.Id or recipient.Id in the VF EmailTemplate, we cannot access to any of this fields, like the email has no context.

Expected: We can access to relatedTo.Id or recipient.Id merge fields.

Result: We cannot access to relatedTo nor recipient merge fields.


<messaging:emailTemplate subject="{!$Label.AccountEMailWelcomeSubject}"
recipientType="User" relatedToType="Network" language="{!recipient.LanguageLocaleKey}">

<messaging:htmlEmailBody >
<c:EmailTemplate emailHeaderUrl="{!$Label.EmailHeaderImageWelcomeEmail}">
<c:EmailSalutation user="{!recipient.Id}"></c:EmailSalutation>
<c:EmailBody >
   <apex:outputText value="{!SUBSTITUTE($Label.AccountEMailWelcomeBody,'%CONFIRMATIONLINK%',$Network.NetworkUrlForUserEmails)+$Label.EmailRegards}" escape="false"></apex:outputText>

We also tried changing the recipientType to Contact and the relatedToType to Contact and also both to User and Both to Contact. No success, even in some cases email was not triggered: https://trailblazer.salesforce.com/issues_view?id=a1p3A000001YpaxQAC&title=resetting-a-person-account-password-using-resetpasswordwithemailtemplate-and-visualforce-template-does-not-send-email-correctly

We have PersonAccount enabled in our system.

Thanks a lot for your time, any help is appreciated.

  • we r also facing same issue, did you find any solution ? if yes, please post here
    – sdandamud1
    Apr 14, 2023 at 2:51


You must log in to answer this question.