I was trying to put a formula inside email template. Example:
If User is A, then 'the customer', else <current user>

Is it possible to that? any ideas will be helpful,

  • 2
    did you try putting formula in email template? – Santanu Boral Feb 10 '17 at 6:54
  • It is possible to put formula inside email template. Ex: {! if(Contact.Description != null, Contact.Description, "No")}. Try putting formula as per your use case and test it. – mohammed azarudeen Feb 10 '17 at 7:19
  • Thanks for the reply. How to bring Current User Name in the template.? – maruf Feb 10 '17 at 20:39

I suggest creating a formula field on the object and using that in the template, as that can definitely reference the current user with the $User global variable

Ive read that you can use basic formulas like {!IF(xxx)} in standard Email templates, but haven't seen it officially documented, and don't believe you could reference the current user global variable, but would have to be tested.

The considerations on merge field documentation shows how to design for a default/alternate value if a merge field is null, but doesn't specifically indicate that formulas are supported

In email templates, you can add substitute text to any merge field. Substitute text appears in a sent email if the merge record does not contain data for that field. To add substitute text, place a comma after the field name and enter the text before the closing bracket, for example: Dear {!Contact.FirstName, Valued Customer}. When you save the template, the merge field appears in the template as Dear {!BLANKVALUE(Contact.FirstName, "Valued Customer")}. In this example, if there is no information in theFirst Name field of the contact record, the email you create with your template begins with “Dear Valued Customer”.

Or you can use a visualforce email template which fills supports all formulas and much more, but the content can't be edited by the sending user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.