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
Kate StarostinaKate Starostina 

Need helping sending an email from a custom button on Lead object

I will preface this with saying that I do not code.  I have a field on the Lead object called Distributor_Contact_email__c.  I would like to create a button that when clicked, would send an email template to that email address.  I found the code below in this forum, but it's not working.  Any help appreciated.  Thank you.

location.replace('/_ui/core/email/author/EmailAuthor?p24={!Lead.Distributor_Contact_email__c}&p3_lkid=
{! Lead.Id }&retURL=%2F{!Lead.Id }&template_id=00XC0000001LMO5')
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi Kate, 

Please find the below code, 

location.replace('/_ui/core/email/author/EmailAuthor?p24={!Lead.Distributor_Contact_email__c}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=<Template ID>')


Thanks,
Vinoth


 
Kate StarostinaKate Starostina
Thank you for that.  On the template, the merge fields are not populated.  Do you know the reason for that?
Vinoth Vijaya BaskerVinoth Vijaya Basker
Please try the below code where I have made few changes,


location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&
p24={!Lead.Distributor_Contact_email__c}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=<Template ID>')


Thanks,
Vinoth
 
CharlotteMaryHaileyCharlotteMaryHailey
Thanks Vinoth, i just used this code in my org and worked like a charm!