Wednesday, March 9, 2016

Developer: Launching Standard Salesforce Email Window without pre-populating

If you have the Email related list on your Case page layout then typically it has a standard Send Email button. This button when clicked launches the Salesforce standard Email Window but also pre-populates fields like

  • To
  • BCC
  • Related To
Recently, this became a show stopper on our project.

Solution

Create a custom button on your page layout and define it to execute Javascript.

When you click on the standard Send Email button it launches the URL as follows:
https://xx.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=500J000000E12vx&retURL=%2F500J000000E12vx

We are going to borrow the URL that the standard button launches of course with some modifications to it. Notice the p3_lkid=500J000000E12 that is what pre-populates the value on the Email form.

Enter the Javscript for your custom button as follows:

window.open("https://xxx.salesforce.com/_ui/core/email/author/EmailAuthor?&retURL=/{!Case.Id}"

Some Cons of the above approach that I have noticed so far:

  • While the Standard Email button launches within its framework the above button launches the Email window as a seperate tab. 
  • It also does not automatically does not save the Email against the case.

I am sure the Email window can be opened as Pop-Up or a Modal Dialog using javascript.


No comments:

Post a Comment