Question
November 29, 2007 at 04:05 PM
matt

javascript referencing extrenal database

by matt . Updated 18 years, 11 months ago

I am having some difficulty with this script.
It was sent to me by a colleague to modify. There may be some redundant code there, as I only need a small part of what it originally did and have removed what I considered to be irrelevant.

I think I am close – but I keep getting a syntax error.

The DB is a Salesforce.com account.

Any help would be greatly appreciated!!!


{!REQUIRESCRIPT(“/soap/ajax/9.0/connection.js”)}



var records =
{!GETRECORDIDS($ObjectType.Participants__c)};



if (records[0] == null) {

alert(“Please select at least one attendee to
email.”);

}

else {

for ( var contactQR =
sforce.connection.query(“SELECT Participant FROM Participant__c Where Id = ‘”
+ contactName+ “‘”);

var contactName =
contactQR.getArray(‘records’)[0].Participant__c;



//Bind and send email

var singleEmailRequest = new
sforce.SingleEmailMessage();


singleEmailRequest.charset = “UTF8”;

singleEmailRequest.subject = “”;

singleEmailRequest.saveAsActivity = true;

singleEmailRequest.targetObjectId =
participant__c;



singleEmailRequest.htmlBody = “face=arial size=2>src=’https://emea.salesforce.com/servlet/servlet.FileDownload?file=015200000008PB3′
border=’0’>” +



//singleEmailRequest.plainTextBody = “Plain
text body”;

sendEmailResults =
sforce.connection.sendEmail([singleEmailRequest]);

}



alert
(“Your emails has been successfully
sent to selected attendees.”);

}

This discussion is locked

All Comments