I want to use email templates based on standard object (lead/contact) country. example, if Country 'USA' chose Template A, Country 'Canada' Choose Template B Automatically.
Can this be achieved in a workflow or formula ?
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 want to use email templates based on standard object (lead/contact) country. example, if Country 'USA' chose Template A, Country 'Canada' Choose Template B Automatically.
Can this be achieved in a workflow or formula ?
in a workflow, you can set the criteria. Add the condition where contact's country = USA. then in the email alert you can select the USA email template to get sent out.
if you want to only show the american templates to the american contacts, that won't work. Email templates are stored in folders who's security is based on roles.
Yes we can't choose template based on some fields value, to be specific based on country but have a look at my workaround let me know if that is okay(It works like a charm for me). 1. Created a visualforce email template. 2. Added output panel components to vf page 3. Added rendered attribute. When "rendered" is true, the element will be displayed. eg. rendered="{!IF(RelatedTo.Country == 'UNITED STATES',TRUE, FALSE)}"> 4. Added the email content to the element. I needed this for different countries and working fine for me.
I hope this helps somebody.
rendered="{!relatedTo.Country = 'United States'}"
, without the whole if... true, false
business. Make sure to check the sent email's body - maybe there are some hidden elements related to other countries that could be removed (maybe other countries need to send sensitive info that US shouldn't see). Last but not least - check how the plaintext version looks like, you'll probably have to duplicate the logic? Leave yourself some comment to keep both sections in sync :/
May 14, 2014 at 21:47
You cannot choose the template based on some field's value. Have 2 workflows and in each of it check for the country and in the workflow action select the USA template for USA country value and same for CANADA.