emailMerger.setEntity()似乎没有将使用过的模板与实体合并

时间:2015-06-19 13:21:15

标签: netsuite

我正在尝试将用户事件的模板邮件(可编写脚本)发送到我沙箱中的客户,下面是我的代码:

var emailMerger = nlapiCreateEmailMerger('22');
emailMerger.setEntity('customer', customerId);
 // emailMerger.setRecipient('customer', customerId);
var mergeResult = emailMerger.merge();
var emailSubject = mergeResult.getSubject();
var emailBody = mergeResult.getBody();


emailBody = emailBody.replace('{1}', name);
emailBody = emailBody.replace('{2}', date);

nlapiSendEmail('20', 'user1@mytestserver.com', 'Test Mail',emailBody, null, null, null, null);

但遗憾的是,我无法在该客户的通讯标签下看到任何邮件合并。这里有什么我想念的吗?

1 个答案:

答案 0 :(得分:1)

var obj = nlapiLoadFile(9398);
var records = new Object();
records['entity'] = '1752';
nlapiSendEmail('-5', '-5', 'emailSubject','emailBody', null, null, records, [obj]);

this will work mail and attachment will save in communication tab.