首页 > 解决方案 > 通过子列表创建自定义记录时发送电子邮件

问题描述

我的销售订单表单上有一个子列表,允许用户直接从销售订单添加自定义记录。

我想做的是在创建该自定义记录时发送一封电子邮件,但在通过子列表创建记录时它不起作用 - 仅在从自定义记录表单创建时。

通过子列表创建记录时是否可以发送电子邮件?

标签: netsuite

解决方案


从子列表创建的事件不会被 UserEvent 捕获。您可以创建一个 ClientScript,捕获事件 sublistChanged(context),然后调用一个套件从后端发送电子邮件。

define(['N/runtime', 'N/url', 'N/https'],
    function(runtime, url, https){
    
    function sublistChanged(context) {
    
        try {               

            console.log('Debug: ', '* * * S t a r t * * *'); 

            var suiteUrl = url.resolveScript({
                scriptId: 'customscript_xxxxx_xxxxxxx',
                deploymentId: 'customdeploy_xxxxx_xxxxxxx',
                returnExternalUrl: false,
                params: {
                        custparam_custid : intCustId,
                        custparam_authorid: userObjId
                        
                    }
            });

            var response = https.get({
                                url: suiteUrl
                            });
                
            }catch (error) {
                console.log('error: ', error);                
            }
    }
    
    return {
            sublistChanged: sublistChanged
        }
});


推荐阅读