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
moeoomoeoo 

Populate Custom object's fields to template

Hi
 
I'm trying to populate the custom object fields to template.
 
I can populate the contact fields to template before I send email.
 
This is the code I used for Contact but how can I get field values from Custom object.
 
var accountid = "{!Account.Id}";
queryResponse  =  sforce.connection.query("select id, Email from contact where AccountID = '" + accountid + "'");
records = queryResponse.getArray("records");
var contactID = records[0].Id;
var contactEmail = records[0].Email;
//alert(contactID);
var massRequest= new sforce.MassEmailMessage();
var ids = new Array();

 ids[0] = contactID;
massRequest.targetObjectIds = ids;
//alert(massRequest.targetObjectIds);
massRequest.subject = "test";
massRequest.replyTo = user;
massRequest.templateId = templatedId ;
try
{
var sendMailRes = sforce.connection.sendEmail([massRequest]);
alert('Email sent to user id: ' + contactEmail);
}
catch(err) {
alert(err)
}
 
I can get the Id of my Custom object but it didn't populate the values. Can I use custom objects here?
SMasterSMaster

If you have found an answer of the question.. you had raised above.. please revert...