You need to sign in to do that
Don't have an account?

How to send email to Contact Roles in opportunity object using custom link button
I have created the following javascript code but still in error
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/39.0/apex.js")}
var emailAddresses = '';
var template_name = 'Congrz Mail';
var customRecord = sforce.connection.query("SELECT id,contact.Email FROM OpportunityContactRole WHERE Id ='"+ '{!Opportunity.Id}'
+"'");
emailAddresses = customRecord.records.Email;
var email_template = sforce.connection.query("SELECT id FROM EmailTemplate WHERE name ='"+ template_name+"'");
var templateid= email_template.records.Id;
location.replace('/email/author/emailauthor.jsp?&p24={!customRecord .Email}&template_id=00X6F000001Ge1kUAC&p3={!customRecord .Name}&p26={!customRecord .Email}&p2={!customRecord .Id}');
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/39.0/apex.js")}
var emailAddresses = '';
var template_name = 'Congrz Mail';
var customRecord = sforce.connection.query("SELECT id,contact.Email FROM OpportunityContactRole WHERE Id ='"+ '{!Opportunity.Id}'
+"'");
emailAddresses = customRecord.records.Email;
var email_template = sforce.connection.query("SELECT id FROM EmailTemplate WHERE name ='"+ template_name+"'");
var templateid= email_template.records.Id;
location.replace('/email/author/emailauthor.jsp?&p24={!customRecord .Email}&template_id=00X6F000001Ge1kUAC&p3={!customRecord .Name}&p26={!customRecord .Email}&p2={!customRecord .Id}');