Is there a way to find out what Template user selected when sending an email? I was looking at it in the EmailTemplate object field called TemplateType this will give you either Text' orVisualforce` etc... but how would you have a reference to EmailMessage or Case from EmailTemplate?

I'm after finding out which EmailTemplate user have selected while sending an email?

I do not see any reference between EmailTemplate/EmailMessage and Case object

Is there a better way to find out? or have reference?

  • do you know whether there are any updates to this, a year and a half after? How did you solve your problem?
    – Alphaaa
    Oct 5, 2017 at 16:50
  • I don't remember its been so long, sorry
    – Nick
    Oct 5, 2017 at 16:52

1 Answer 1


I've had this asked of me a few times, and the best way I've found is to embed some sort of unique identifier in the template itself. If you're using HTML templates, you can make the identifier less visible or totally invisible. If you're using text templates, your identifier will be visible. In both cases, your user could potentially delete your identifier if they edit the message before sending it.

EmailMessage doesn't have any sort of relationship to EmailTemplate outside of its content.

  • I'm using Visualforce template is that the only option?
    – Nick
    Mar 22, 2016 at 15:03
  • Same holds true with a Visualforce template. One advantage is your users don't get to edit the email before sending it if they're using a VF template. Mar 22, 2016 at 16:49

You must log in to answer this question.

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