1

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 ?

1
  • Is it about workflows/triggers/other automation or something that should happen when user manually hits "send an email" button? You could make your own button pointing to emailauthor.jsp, check salesforce.stackexchange.com/questions/25457/… for example (make a formula that'd be picking different template id)
    – eyescream
    May 8, 2014 at 9:17

3 Answers 3

1

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.

2
  • It has to be country based template and automated. I need a workaround :(
    – user7307
    Apr 10, 2014 at 14:51
  • Can you please clarify why? the workaround i'd look into involves vf components and controllers, where you set the body of the email template to one of your existing email templates. I'm not sure if you can even do that, To be frank. Apr 10, 2014 at 16:07
1

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.

1
  • 1
    You can have 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 :/
    – eyescream
    May 14, 2014 at 21:47
0

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.

1
  • i understand that, but thats not the requirement. I need to find a way.
    – user7307
    Apr 10, 2014 at 14:50

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.