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
JohnSwordJohnSword 

Automatically send email using a button

I'm trying to create a custom button that automatically sends an email to a lead...

location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=00Xi0000000h3Qh&p5=&save=1');

Everything works well until the "&save=1" at the very end which is what actually send the email.

 

Can anyone help me understand what I'm doing wrong?

 

Thanks,

John

 

Best Answer chosen by Admin (Salesforce Developers) 
JohnSwordJohnSword

Sometime in 2012, Salesforce disabled the "save=1" function by default.  To enable the "save=1" function for custom buttons...

 

Disabling CSRF Protection on GET Requests.

 

Navigate to Setup | Security Controls | Session Settings. Uncheck 'Enable CSRF Protection on GET Requests on Non Setup Pages' and click Save.

 

Note that disabling this security feature will make you vulnerable to Cross-Site Request Forgery. More information can be found here:  https://na1.salesforce.com/help/doc/en/review_and_certification.htm

 

My button with the original above code works fine now.

 

All Answers

Amritesh SinghAmritesh Singh

HI John,

 

Every thing is right, just try  "&save=0"  in that url .

 

 

Regards,

Amritesh

JohnSwordJohnSword

Thanks for the reply.  Unfortunatly still the same.  I'm open to other suggestions.

 

John

JohnSwordJohnSword

Thanks for the suggestion.  This link was how I came up with the code.

JohnSwordJohnSword

Sometime in 2012, Salesforce disabled the "save=1" function by default.  To enable the "save=1" function for custom buttons...

 

Disabling CSRF Protection on GET Requests.

 

Navigate to Setup | Security Controls | Session Settings. Uncheck 'Enable CSRF Protection on GET Requests on Non Setup Pages' and click Save.

 

Note that disabling this security feature will make you vulnerable to Cross-Site Request Forgery. More information can be found here:  https://na1.salesforce.com/help/doc/en/review_and_certification.htm

 

My button with the original above code works fine now.

 

This was selected as the best answer