Custom "Reply to Email Task" Button - Answers - Salesforce Trailblazer Community
Ask Search:
Roger WickiRoger Wicki 

Custom "Reply to Email Task" Button

Hey there

We would like to be able to reply to an email stored as email-task in salesforce. For that, I created a custom button on task layer to "reply to email".

The code for this "on click Java script" button is as follows:

/email/author/emailauthor.jsp
?retURL=/{!Task.Id}
&p3_lkid={!Task.What}
&rtype=003
&p2_lkid={!Task.Who}
&template_id=00XD0000001kksq
&p5=

Currently, when clicking the button, the only things that actually happens is that the related to field is filled with the {!Task.What} Information (which is in my test case, an opportunity) and the To is filled with the {!Task.Who}.

I would like to know, how I can:
1) Set the "Subject" field to the {!Task.Subject}, led by "RE: "
2) Set the HTML Body of the Email to {!Task.Description}

I know that I need to use those merge fields on the email template. I already do this, but it does not work. I have a clue why:
On here (http://forcetips.blogspot.ch/2013/02/url-hack-to-send-email-by-simple-button.html) I found the information, that the "p3_lkid" stores not only information from the "related to" record, but also is the base for the Email Template merge fields. Because in my case the "p3_lkid" is related to an opportunity, I can no longer access the task in the email template over merge fields.
Unfortunately, a task can't be related to a task itself again as far as I know, so this would not work...

Or am I doing something entirely wrong?
Any help appreciated

Roger
Best Answer chosen by Roger Wicki
Deepak AnandDeepak Anand
Hey Roger,

All your findings are absolutely correct. If you are willing to send or go with a Plain Text Email then you would do something like this:

/_ui/core/email/author/EmailAuthor
?retURL=/{!Task.Id}
&p3_lkid={!Task.What}
&p2_lkid={!Task.Who}
&template_id=00X90000001WwRB
&p7={!Task.Description}
&p6=RE:+{!Task.Subject}

Best,
Deepak

All Answers

Deepak AnandDeepak Anand
Hey Roger,

All your findings are absolutely correct. If you are willing to send or go with a Plain Text Email then you would do something like this:

/_ui/core/email/author/EmailAuthor
?retURL=/{!Task.Id}
&p3_lkid={!Task.What}
&p2_lkid={!Task.Who}
&template_id=00X90000001WwRB
&p7={!Task.Description}
&p6=RE:+{!Task.Subject}

Best,
Deepak
This was selected as the best answer
Marija JovanovicMarija Jovanovic
Hello Roger,
I see that you are getting some feedback on this.  May I also suggest re-posting your question on our Developer Community at developer.force.com.  This community is more tailored towards developer and coding topics.  Please do share your resolution with the community, or mark a post as "Best Answer" that has helped you resolve this, in order to assist others in the community with similar questions.  Thanks.
Roger WickiRoger Wicki
Plain text Email was good enough and I even figured out how :-D

Thanks for your efforts