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,
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityI 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,
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.