+ Start a Discussion
Rob LilleyRob Lilley 

Email button code on custom object - set 'To' field to a specific email address

Hello, I wonder if anyone could help please?

We have a custom email button on a custom object. We would like to double-check the email before sending to the actual recipient by sending it to a 'fixed' email address which is our organisation (where it can be forwareded after checking).

I wonder if this is possible? The code for the button is below.

Many thanks, Rob  

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
var query = "Select ContactId, OpportunityId, IsPrimary From OpportunityContactRole Where OpportunityId='{!Opportunity.Id}' AND IsPrimary=true"; 
var result = sforce.connection.query(query); 
var records = result.getArray("records"); 
var location ="/_ui/core/email/author/EmailAuthor?new_template=1&template_id=00X0Y000000IXbS&p3_lkid={!Match__c.Id}&retURL=/{!Match__c.Id}&rtype=003";; 
var contId =''; 
if (records != '') { 
contId = records[0].ContactId; 

if( contId != '' ){ 
location = location+"&p2_lkid="+contId; 

window.location=location ;