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
Abdul RazzaqAbdul Razzaq 

Custom Email Button on Lead page.

Code:-

location.replace('/email/author/emailauthor.jsp?retURL=/{!Lead.Id}&p3_lkid={!Lead.Email}&rtype=00Q&p2_lkid={!Lead.Id}&template_id=00XA0000000RfyB&p5=&save=1');

Error:-

The value of the "p3_lkid" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information. 
 

Rahul BorgaonkarRahul Borgaonkar
Hi

p3_lkid={!Lead.Email} should be id and not email.Please check link below for more clarification.

https://success.salesforce.com/answers?id=90630000000gtNyAAI
example
location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=<your template here>');

Also save=1 is no more supported by Salesforce. Please let me know if its working for you.

Best Regards,

Rahul
Abdul RazzaqAbdul Razzaq

Hi Rahul,

Even though I changed the code to following:-

location.replace('/email/author/emailauthor.jsp?retURL=/{!Lead.Id}&p3_lkid={!Lead.Id}&rtype=00Q&p2_lkid={!Lead.Email}&template_id=00XA0000000RfyB&p5=');

I get similar error.

And the link you sent me, it is from there I picked the syntax.

Rahul BorgaonkarRahul Borgaonkar
Hi, Could you please share complete code? Would like to see how you are populating Lead.Id value. Also try to put actual Lead Id similar to below, Hardcoding values.. I am not sure about p2_lkid too, please make sure if correct value is used there. location.replace('/email/author/emailauthor.jsp?retURL=/00QD000000oUcfi&p3_lkid=00QD000000oUcfi&rtype=00Q&p2_lkid={!Lead.Email}&template_id=00XA0000000RfyB&p5='); Please put correct lead.id from your org, lead id above will not work in your org. Regards, Rahul Rahul Suresh Borgaonkar
Abdul RazzaqAbdul Razzaq

Do I need to do more coding??

What all I am trying to do is; create a custom button in Lead object and select "Execute on Javascript" and place the above lines in that editor mode area and save it.

And I have added that custom Email Button in Lead detail view. When I click the Email button it should fetch Email value from Email field and send mail to the following Email Id. About p2_lkid; I am getting the value of Email Id in it.

For now, even when I put the Id of the specific record in p3_lkid I get the similar error.

This is how, I have done it:-

 

location.replace('/email/author/emailauthor.jsp?retURL=/{!Lead.Id}&p3_lkid=00Q9000000kXlnK&rtype=00Q&p2_lkid={!Lead.Email}&template_id=00XA0000000RfyB&p5=');

Rahul BorgaonkarRahul Borgaonkar
Hi, Please find my working link /email/author/emailauthor.jsp?retURL=/a0DD000000YzuS2&p3_lkid=a0DD000000YzuS2&p26= rahul.borgaonkar@gmail.com&p24=rahul.borgaonkar@gmail.com &template_id=00XL0000000EArd&p5= a0DD000000YzuS2 is our custom object, you can hardcode with lead.id and try it. Let me know how it goes. Thanks, Rahul Rahul Suresh Borgaonkar
Abdul RazzaqAbdul Razzaq

It doesnot work either. Same error. Thank you for your help.

I would better try using Vfpage custom controller.

Rahul BorgaonkarRahul Borgaonkar
Ok mate, Cheers Rahul Suresh Borgaonkar