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
Kirsty BeyersKirsty Beyers 

Error with 'Email Button' on the Opportunity page layout

I am in the process of setting up an email button on the opportunity page layout. 

I followed this article - https://success.salesforce.com/ideaView?id=087300000006tqzAAA which was a great guide, but I am having problems. I substituted the 'case' for Opportunity & there were no problems with the syntax. However, when I tested the button I got the following error - 

Unable to Access Page
The value of the "template_id" 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. 

I later found some pointers here, and tried the following URL:

/_ui/core/email/author/EmailAuthor?rtype=003&p3_lkid={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}&p5={!$User.Email}&p24&template_id=00XC0000001O7Ck

Problem here is the following error (below) 

User-added image


Changed it to & still received an error

_ui/core/email/author/EmailAuthor?rtype=003&p3_lkid={!Opportunity.Id}&retURL=!Opportunity.Id}&p5={!$User.Email}&p24&template_id=00X20000001Fom6

User-added image

Thanks in advance!
Best Answer chosen by Kirsty Beyers
Anurag SaxenaAnurag Saxena
Hi Kirsty,

User-added image

I have implemented your requirement in my org and it seems to work perfectly

Please add these onclick javascript in your Detail Page custom button:


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

Replace this 15 digit ID 00X28000001WPqD with your email template ID.

Try it and let me know what happens

Thanks

All Answers

Anurag SaxenaAnurag Saxena
Hi Kirsty,

User-added image

I have implemented your requirement in my org and it seems to work perfectly

Please add these onclick javascript in your Detail Page custom button:


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

Replace this 15 digit ID 00X28000001WPqD with your email template ID.

Try it and let me know what happens

Thanks
This was selected as the best answer
Kirsty BeyersKirsty Beyers
Thank you so much Anurag! This is finally working!!