All Ideas

Idea Details

Post an Idea
1,090  Points
Under Point Threshold
Idea hasn't met the 2,500-point review threshold. Give it an upvote or downvote.

The Quick Email Button

Accounts & Contacts

...or, mastering the black art of URL hacking the email page.
 

Sending an email from Salesforce.com can be a clicky operation.  You dig around for the Send An Email button, click it, click Select Template, find your template and click it, maybe type some more stuff in the email, and finally click Send.  That's a lot of clicks, especially for organizations where they just use the same template over and over.  Well, the good news is that you can make this a much less clicky operation by making a custom button which changes the URL parameters.  Technically URL-hacking is not supported by Salesforce.com, and it's technically not a supported API, so be forewarned -- but when you're on a quest to reduce clicks, you gotta do what you gotta do.
 

So let's say you have a template that you usually use for Cases which contains some pleasantries and then a merge field that adds in the text of any related Solutions.  If you've not used Email Templates much before, by the way, have a look at the sample template entitled "SUPPORT: Case Response with Solution (SAMPLE)" --  it does just what I've described here.  Anyway, what you'll want to do is make a custom button that preselects this template.  It's quite simple really.
 

  • The first thing you'll need to do is get the ID of the template you want to use.  This can be found by finding the template via Setup->Communication Templates->Email Templates.  Click on it and look in the URL -- you'll see an ID up there that looks like 00X30000000rNM0 (which may be followed by a ? with some other parameters -- ignore that stuff, just take the 15-character ID that starts with 00X).  Copy that ID into Notepad or someplace where you can get to it later.
  • Now go to Case and create a Custom Button -- let's call it Email Solution.  Set its Behavior to Execute Javascript and its Display Type to Detail Page Button.  In the Javascript area add this line of code, replacing the <your template here> with the ID of the template you saved earlier:   location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=<your template here>');
  • Now add this custom button to your Case page layout, and voila, you have a one-click button that will bring up your email complete with template.

But wait, there's more!

To this we can actually add a few more bells and whistles.

By default the Send An Email page likes to BCC the sender.  Many call center agents I talk to find this rather annoying.  With the addition of another URL parameter to our custom button, we can stop it from BCCing anyone.  The parameter is p5, so our new code would be:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=<your template here>&p5=');

Notice at the end there the "&p5=" -- that sets the BCC area to empty.

But what if you just want to send the email in one click with no edits?

Well, you can do that too, with -- you guessed it -- one more URL parameter: the save parameter.  If I take the above code and add a save=1 to it, then when I click the button, the email will just be sent, and the Case page will refresh itself to indicate that an email was sent:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=<yourtemplate here>&p5=&save=1');

And what if you want to change the From address?

You may have noticed that if you have Email To Case enabled with some routing addresses, or if you've modified the email address in the My Email Settings page in the Personal Information area of Setup, that when you go to send an email you have a choice of From addresses.  You can default this From address too!

The From address is just another parameter in the URL -- it's p26.  So taking our earlier example, let's add a From address default:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=<yourtemplate here>&p26=me@mydomain.com');

Note that the p26 default will only work for items that are actually in that From address list.

And that ends today's lesson on email buttons. 

Happy emailing!

· Flag

  • Upvotes
  • Downvotes

Ideas

Apps

from AppExchange

Questions

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



 

 

Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


 

Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.