Site icon UnofficialSF

Send HTML Email with Multi-Language Support for Lightning Email Templates

This is extended functionality of Send Rich Email.

SalesForce Orgs and Communities often require multiple language support, including the ability to generate emails in the selected language of the Community anonymous user, member or Org User.

LightningFlowComponents/flow_action_components/SendHTMLEmail/ has been extended to send the appropriate language email based on the preferred language as part of a flow action to send email. This Action uses Lightning EmailTemplates, and has not been tested on Classic Templates (yet).

For this functionality, each language localization has its own template, that shares a common EmailTemplate.Name. To differentiate the localizations, add a tag to the EmailTemplate.Description field in the format: ‘Language=”en_US”‘ (or whatever corresponding to your organization localizations).

When the sendHTML templateName and templateLanguage parameters are used, the action selects the template with the matching templateName and the ‘Language=”xxx_YY”‘ tag in the Description. (Note, no spaces, exact match only)

Template Selection criteria order is prioritized using matching EmailTemplate:Name and:

  1. If templateLanguage is empty, set to Organization LanguageLocaleKey
  2. If templateLanguage tag is found in EmailTemplate.Description (e.g., ‘Language={{{templateLanguage}}}’)
  3. First matching template with matching templateName but no corresponding ‘Language=”‘ tag in EmailTemplate.Description

Example:

Step 1: Identify the Common EmailTemplate:Name for the Template Set you would like to use for localization and copy the name. (App Launcher–>Email Template[lightning]). (Note, in this case it would be “OAG OCP Complaint Received Email” – and there are two tagged locales identified in the Description Field, “en_US” and “es_MX”)

Step 2: Add the Apex action to your Flow and set the Parameters:

Caveats

Limitation: Enhanced Letterheads are not supported in Lightning Communities at this time. A support request has been submitted and it is being worked on by SF. If you attempt to use the Enhanced Letterhead in a Community application, you will get the following error: sObject type ‘EnhancedLetterhead’ is not supported. If you are attempting to use a custom object, be sure to append the ‘__c’ after the entity name. Please reference your WSDL or the describe call for the appropriate names.: []

Kludge Acknowledgement: The elegant solution would have a localization field in EmailTemplate (e.g., EmailTemplate.LanguageLocaleKey ). At this time, no such field exists and you cannot add custom fields to EmailTemplate Object – ergo, a tag parsed from the standard “Description” is the kludged approach.

SEE ALSO

Exit mobile version
Skip to toolbar