+ Start a Discussion

How to use mail merge using sControl

I have 50 mail merge templates with different details. Based on state, it should select particular mail merge template. I want to write a sControl which can select particular mail merge template based on state.
How can I do this sControl?
Thanks in advance.

Message Edited by Sunil on 03-20-2008 02:46 AM
Hi Sunil,

The code given below can help you to resolve the problem

var massRequest = new sforce.MassEmailMessage();
contactIDArray[0]= contactID;
massRequest.targetObjectIds = contactIDArray;
massRequest.replyTo = replyTo;
massRequest.subject = 'RE:'+ '{!Case.Subject}';
massRequest.templateId = templateId;
var sendMailRes =  sforce.connection.sendEmail(mailRequest);


where contactID is the target ids where we need to send the email and templete id is the ID of your template.