2

Is that possible to use a Custom Label/Settings/Metadata inside an Email Templates by referencing? instead of creating a formula field as it was suggested here

2 Answers 2

1

In a Plain Text or HTML template, you need a formula, but in a Visualforce template, you can use the global variables directly to access labels, settings, metadata, etc.

3
  • 1
    I thought things might have changed in Salesforce world but looks like still the same :) so I have no other choice but to use formula field inside the email templates?
    – Nick
    Commented Jun 2, 2022 at 0:38
  • 1
    @NickKahn as far as I can tell, yes. They haven't updated classic email template in ages.
    – sfdcfox
    Commented Jun 2, 2022 at 0:39
  • 1
    @sfdcfox - I have a somewhat different answer here
    – cropredy
    Commented Nov 16, 2022 at 20:29
1

At least for HTML templates, the following merge fields:

Global Variable Renders Notes
$API.xxx NO
$CustomMetadata.xxx NO
$Label.xxx YES [1]
$ObjectType.xxx NO
$Organization.xxx YES [1]
$Permission.xxx YES [1]
$Profile.xxx YES [1]
$Setup.xxx YES [1]
$User.xxx NO
$UserRole.xxx YES [1]

Where renders YES means:

  • When email preview is sent to recipient
  • When email is sent by automation or code
  • When email is sent by Email Publisher (e.g. send email from a Case)
  • When you use renderStoredEmailTemplate() method

Notes

[1] No rendering is done in the Classic Email previewer; Email Publisher will render in the preview (e.g. sending an email from a Case)


I did not look at other Global variables as they are mostly for use in a Visualforce Context where they are defined by definition to work in VF emails

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .