Skip to main content

Return to TX Community

Liaison

Configuring a Custom Welcome Email when using Multiple Communities

Note:  This update can only occur within Sandbox and then perform a change set to Production in order to save those changes.

The TX_CommunitiesSelfRegController Apex Class and TX_CommunitiesSelfRegConfirm Visual Force page must be modified in a Sandbox and moved to production via a Change Set. For additional information, please see: Deploying from Sandbox with Change Sets.

Step 1:  Disable all welcome emails for communities

  1. Navigate to Setup and search for Digital Experiences (formerly All Communities).
  2. Select the Manage link next to your first Community.
  3. Select the Administration option in the left pane and then Emails.
  4. Uncheck the Send Welcome Email option in the “Email Templates” section.
  5. Save your changes.
  6. Repeat steps 2-5 for each Community.

Step 2: Edit the Forgot Password Email Template to be a ‘Welcome Email’

  1. Select Setup and search for Classic Email Templates.
  2. Select the Folder = Unfiled Public Classic Email Templates.
  3. Click on the Communities: Forgot Password Email template name.
  4. Select the Clone button and provide a unique name for the new template. 

Default email template: Forgot Password Email Template

Best Practice: If you are using multiple Communities, the Forgot Password email should be designed to accommodate both New registrants AND those who forgot their password.

  1. Update the Subject and Email Body. You can use the following sample text:

Hi {!Receiving_User.FirstName},

 

Thank you for visiting {!Community_Name}! Click the link below to create your password.

Your Username: {!Receiving_User.Username}

Button Link: {!Community_Url}

Thanks,
{!Organization.Name}

create password example

  1. Save your changes.

Step 3: Update self register controller to pass username to self register confirm controller  

  1. Navigate to Setup and search for Apex Classes.
  2. Click the TX_CommunitiesSelfRegController.
  3. Click Edit.
  4. Locate the following text (approximately line 85):  

 PageReference page = System.Page.TX_CommunitiesSelfRegConfirm;

  1. Add the following AFTER the above text:

// passes userName to self reg confirm page
page.getParameters().put('username', userName);

Step 4: Add Self Register Confirm Controller to send out reset password email

  1. Save your changes.
  2. Navigate to Setup and search for Apex Classes.
  3. Select the New button.
  4. Paste the following into the new class:

//code
public with sharing class TX_CommunitiesSelfRegConfirmController {
 
    public TX_CommunitiesSelfRegConfirmController() {
        sendWelcomeEmail();
    }
 
    public TX_CommunitiesSelfRegConfirmController(TargetX_Base.TX_CommunitiesBase controller) {
        sendWelcomeEmail();
    }
   
    private void sendWelcomeEmail() {
        String userName = ApexPages.currentPage().getParameters().get('username');
        if(String.isNotBlank(username)) Site.forgotPassword(userName);
    }
}

  1. Save your changes.

Step 5: Update Self Register Confirm page to use new Apex Class that was added in previous step 

  1. Navigate to Setup and search for Visualforce Pages.
  2. Click on TX_CommunitiesSelfRegConfirm.
  3. Select the Edit button.
  4. REPLACE the first line on this page to the following:     

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" expires="0" cache="false" docType="html" controller="TargetX_Base.TX_CommunitiesBase" extensions="TX_CommunitiesSelfRegConfirmController">

  1. Save your changes.

Step 6: Select the new Forgot Password Email Template in your Community

  1. Navigate to Setup and search for Digital Experiences (formerly All Communities).
  2. Locate your Community and click on Workspaces.
  3. Click on Administration and then Emails.
  4. Under the Email Templates section, update the Forgot Password field with the template you cloned in Step 2.
  5. Save your changes.

Validating the new email

To validate that your email works properly, follow these steps:

  1. Navigate to your Community.
  2. Select Signup.
  3. Enter the required information and select Submit.
  4. Check the email address for the user you just signed up.
  • Was this article helpful?