Speed and efficiency are very important to a business.

In Salesforce, if a user wants to send a quick email to a lead via a predefined template, here is the long list of steps:

  1. Open lead page
  2. Click on “send an email” button
  3. In the new page, click “select template” button
  4. Pick the desired email template in a new pop up
  5. Possibly also need to change from user to an organisational email address

Is there a way to shorten the process and cut step 3 – 5 ?

Certainly, we can build a custom button on the record detail page which automatically fills all necessary fields in send email page for us.

Here is how it’s done:

Firstly, find the email template id from the URL https://<instance>.salesforce.com/<your email id>.

Then, (I use Google chrome browser) go to the standard send email page and right click on the from field, choose “inspect”.screen-shot-2016-11-19-at-3-35-20-pm

Exam the highlighted id in the browser console (in this case we have ID p26). screen-shot-2016-11-19-at-3-37-10-pm

Expand the selection and find the desired email address and copy the whole value for that option. screen-shot-2016-11-19-at-3-37-19-pm

By now we have got all the building blocks we need to hack the URL.

The last step is to build the custom URL for our button. We can build this by modifying the current page URL (send email):

Simply change https://<instance&gt;.salesforce.com/_ui/core/email/author/EmailAuthor to https://<instance&gt;.salesforce.com/_ui/core/email/author/EmailAuthor?p26=<the value you collect above>&template_id=<template id you copied from your template url> .


Try hitting enter, see the same page reloads with required fielded prefilled?

We can also extend the power of this method by including more ‘ids’ in the url, for example to auto CC someone in your company (&p4=henry@epic.com for example).

That’s it for today, hope this tutorial inspires you.