将项目实现与高级模板合并,并通过电子邮件发送给Netsuite 2.0

时间:2016-05-16 17:49:40

标签: javascript netsuite

因此,如果没有下面的合并功能,此代码会在保存时发送电子邮件,但我不能在我的生活中获得电子邮件合并在Netsuite 2.0中工作,那么如何将高级pdf模板与项目实现和电子邮件合并它?

/**
 *@NApiVersion 2.x
 *@NScriptType UserEventScript
 */
define(['N/email','N/render', 'N/record', 'N/file'],
    function(email, record, file,render) {  
        function afterSubmit(context) {

        function templatemerge() {
         var myMergeResult = render.mergeEmail({
    templateId: 121,
    entity: {
        type: 'employee',
        id: 18040
        },
    recipient: {
        type: 'employee',
        id: 18040
        },
    supportCaseId: 'NULL',
    transactionId: 1176527,
    customRecord: 'NULL'
    });
        }
        templatemerge();

        function sendEmailWithAttachement() {
        var newId =  context.newRecord;
            var emailbody = 'attachment';
            var senderId = 18040;
            var recipientEmail = 'email@email.com';

            email.send({
               author: senderId,
                recipients: recipientEmail,
                subject: 'Item Fulfillments',
                body: emailbody
            });
        }
        sendEmailWithAttachement();
        }
        return {
            afterSubmit: afterSubmit
        };
    });

1 个答案:

答案 0 :(得分:1)

尝试将第一个功能签名重新排列为function(email, render, record, file)

他们可能是错误的顺序。