function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
michael32michael32 

Pass in value to new email subject & body

Added a custom button on the Case Record that opens a new email. How do I get it to populate the email subject and body? This is the link that I added to the button:

 

https://na14.salesforce.com/_ui/core/email/author/EmailAuthor?htmlBody=hello+world&p2_lkid={!Contact.Id}&rtype=003&p3_lkid={!Case.Id}&retURL=%{!Case.Id}

 

Alternatively, is there any way to pass in a string variable from the URL that populates the subject & body value?  Not interested in using SFDC's email templates, since they cannot be modified before sending.

 

Thanks in advance for the help.

Best Answer chosen by Admin (Salesforce Developers) 
Santosh KumbarSantosh Kumbar

Try using this URL : 
https://na14.salesforce.com/_ui/core/email/author/EmailAuthor?p6=hello+world&p23=This+is+Body&p2_lkid={!Contact.Id}&rtype=003&p3_lkid={!Case.Id}&retURL=%{!Case.Id}

 

 

 

Regards

San

www.santoshkumbar.com

All Answers

Santosh KumbarSantosh Kumbar

Try using this URL : 
https://na14.salesforce.com/_ui/core/email/author/EmailAuthor?p6=hello+world&p23=This+is+Body&p2_lkid={!Contact.Id}&rtype=003&p3_lkid={!Case.Id}&retURL=%{!Case.Id}

 

 

 

Regards

San

www.santoshkumbar.com

This was selected as the best answer
byrdsbyrds

Custom Button or Link Detail

 

Will work w SF Template and you can edit:

 

Name Email_or_Text_Driver

Behavior Execute JavaScript

Display Type Detail Page Button

 

 

OnClick JavaScript:

location.replace('/email/author/emailauthor.jsp?retURL={!Contact.Id}&rtype=003&p2_lkid={!Contact.Id}&template_id=00XE0000000lOIF')

 

This works for me - Clicking button on Contact record and on custom Objects.

I am able to edit the email when it opens.  

Let me know if this helps or if you have any questions.

michael32michael32

I replaced the template_id value with the identifier for one of my html template pages, but I got an error message when clicking the custom button that I created and added to the contact page. This is the error message: 'A problem with the OnClick Javascript for this button or link was encountered: Unexpected Identifier. '

 

This is the code that I used:

 

OnClick JavaScript:
location.replace('/email/author/emailauthor.jsp?retURL={!Contact.Id}&rtype=003&p2_lkid={!Contact.Id}&template_id=00Xd0000001AO1')

michael32michael32

Got it to work:

 

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

byrdsbyrds

Michael,

 

Looks like that was what I recommended.

I am Not sure why I did not get credit for solving the issue.

 

Please give me some Kudos if you feel I helped you solve the issue.

 

At any rate I am glade I could help you solve your problem.

Amit SAmit S
An Old post, but checking if anyone has resolved the requirements to customize the Send Email Page.

Need to add Custom fields from Tasks Objects onto the Email Page once clicked on the Send Email Button.

Has anyone customized the Send email page? Is a VF Page and Custom controller the only option? Appreciate any help or Link to a similar peice of customization on this.

I have tried using window.location = '/_ui/core/email/author/EmailAuthor?p2_lkid=' + cont_result[0].Id + '&rtype=003&p3_lkid={!Account.Id}&retURL=%2F{!Account.Id}&template_id=00XN0000000QfDy'; but this allows only the Body of the email to be customized.

Where as I want Two Custom fields to be shown and allowed to pick values from the Email Page before sending.