Dear All,
Afrer release 2 updated, it announced that we can't use nlapiMergeRecord to send email with CRSMDK template. We should use nlapiCreateEmail api to send scriptable template email. So i changed the script and the template. But when i used nlapiMergeRecord before, it has 6 parameters, id, baseType, baseId, altType, altId, fields.
But help center said: To perform a mail merge with a scriptable email template:
[LIST]
[*]Use nlapiCreateEmailMerger(templateId) to create an nlobjEmailMerger object. The function nlapiCreateEmailMerger(templateId) takes the record ID of a scriptable template as an argument. The objectnlobjEmailMerger encapsulates the scriptable template.
var emailMerger = nlapiCreateEmailMerger(<templateId>);
[*]Use the nlobjEmailMerger set methods to designate the records to perform the mail merge on.
emailMerger.setEntity(<entityType>, <entityId>); emailMerger.setRecipient(<recipientType>, <recipientId>); emailMerger.setSupportCase(<caseId>); emailMerger.setTransaction(<transactionId>); emailMerger.setCustomRecord(<recordType>, <recordId>);
[*]Use the nlobjEmailMerger.merge() method to perform the mail merge. The merge() method returns an nlobjMergeResult object that contains the subject and body of the e-mail distribution.
Note
The nlobjEmailMerger.merge() method has a governance of 20 usage units. The remaining APIs described here have no governance.
var mergeResult = emailMerger.merge();
[*]Use the nlobjMergeResult methods to obtain the e-mail distribution’s subject and body in string format.
var emailSubject = mergeResult.getSubject(); var emailBody = mergeResult.getBody();
[/LIST] In step 2, the record can perform the email on doesn't include event. I want that after i create a event based on a case, system will send email as the specific template. With nlapiMergeRecord, i can set basetype(supportcase) and alttype(event), but with nlapiCreateEmail, i only can set supportcase type and the id, via setSupportCase api. Which should i use to link event id and then i can catch the value on event?