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
AiledrocAiledroc 

Passing parameters to EmailAuthor.jsp

I need to create a "Reply" button for a Task Detail Page that allows a user to reply to a case task when its status is Inbound Email.  I am trying to pass parameters to the EmailAuthor.jsp URL, as suggested in the Quick Email Button Salesforce blog, so that clicking on the "Reply" button brings a user to the Send Email page with the Task's Comments already in the email body.  I tried creating an email template with {!Task.Description} in the body, but email templates cannot access Task fields.  I am currently trying to change the body of the email through the parameters, like so:

 

location.replace("_ui/core/email/author/EmailAuthor?retURL=/{!Case.Id}&p3_lkid={!Task.What}&rtype=003&p2_lkid={!Case.ContactId}&p6=Re:
{!Task.Subject}&p7={!Task.Description}");

 


However, {!Task.Description} is too long to fit into the URL, and I get the following error message: "A problem with the OnClick JavaScript for this button or link was encountered: unterminated string literal."  Does anyone have any suggestions for how I can get around this?

Best Answer chosen by Admin (Salesforce Developers) 
jbossonjbosson

You need to encode the variables.  like: {!URLENCODE(Task.Subject)}

best,

jonas