0

I am interested to understand what is best practices when managing an org with 100+ email templates.

Specially in the circumstance where there is additional logic which needs to control which email template should be used based on Object state.


I have many different email templates which relate to objects like:

  • Meetings
  • People
  • Invoices

And different emails depending on the status and type of the Meeting, or the type of Person or the status of the Invoice

I am planning on creating a Custom Setting which has a reference to each Email Template Id and then adding a formula field to each object to decide which template is appropriate for that object based on it's state at that time.

And to use some Apex with an InvocableMethod to send emails from Process Builder rather than using an Email Alerts, so that I don't need to add random hidden Contact fields on the WhatId object.

I am concerned I am over engineering my solution.

Thoughts?

1 Answer 1

1

Here is a partial answer...

First of all, avoid Email template Ids in custom settings or custom metadata; instead, use the email template developer name and query for the email template in your invocable Apex. Why? Email templates created in sandbox will have different Ids when pushed to PROD (plus Ids are not exactly "self-documenting"). I'd use Custom metadata rather than custom settings as you have control over a page layout to make admin easier.

Secondly, I like to put the email template name at the bottom of the email template markup. Why? When you are diagnosing an issue, you want to to know which email template was used at runtime (because someone will report an issue by forwarding you, the admin, the email received). With 100 email templates, the template name can go a long ways towards rapid diagnosis. If using VF or HTML email templates, you can make the field xx-small so as not to disturb the recipient

You must log in to answer this question.

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