简体   繁体   English

似乎没有调用SuiteScript方法

[英]SuiteScript method does not seem to be called

I have created a script to email the created record to me when a Sales Order is created. 我创建了一个脚本,用于在创建销售订单时通过电子邮件将创建的记录发送给我。 The code below runs perfectly on a NetSuite Sandbox account, which I used for testing. 下面的代码可以在我用于测试的NetSuite沙盒帐户上完美运行。 On the production site however, I never receive the expected email. 但是,在生产站点上,我从未收到预期的电子邮件。 I have enabled suitescript and specified my email in the email preferences. 我已启用套件脚本并在电子邮件首选项中指定了我的电子邮件。

When I deliberately create a syntax error, this is picked up when a sales order is created. 当我故意创建语法错误时,将在创建销售订单时将其提取。 So it seems that the script is connected to the creation of sales orders, yet the method is not executed. 因此,该脚本似乎与销售订单的创建有关,但是该方法未执行。 I am not sure what I am missing.. 我不确定我缺少什么。

My script: 我的剧本:

function OnAfterSubmit(dataIn) {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;


var newRecord = nlapiGetNewRecord();
var fromId = -5; //Authors' Internal ID
var sbj = 'test subject';
var msg = '';  

//Create Text File

var recordAsJSON = JSON.stringify(newRecord);
var newFileObj = nlapiCreateFile('SalesOrder.json', 'PLAINTEXT', recordAsJSON);

if (nlapiGetFieldValue('location') === '3' && nlapiGetFieldValue('status') === 'Pending Fulfillment' && nlapiGetFieldValue('trandate') === today) {
    nlapiSendEmail(fromId, 'email@test.com', sbj, msg, null, null, null, newFileObj);
}

} }

As I mentioned, this script runs in the sandbox account. 如前所述,该脚本在沙盒帐户中运行。 So i don't think the script is incorrect. 因此,我认为脚本不正确。

Script Setup screenshot 脚本设置屏幕截图

Script deployment 脚本部署

My Execution Log shows nothing, except for the errors that I deliberately created to see if the scripts is attached to the Sales Order record. 我执行日志中什么都没有显示,除了我故意创建的错误以查看脚本是否附加到销售订单记录上。

In Sandbox accounts, script emails are sent to the email specified in NetSuite preferences at Setup -> Email -> Email Preferences -> SandBox and Release Preview. 在沙盒帐户中,脚本电子邮件将发送到在设置->电子邮件->电子邮件首选项->沙箱和发行预览中的NetSuite首选项中指定的电子邮件。 Email addresses specified in scripts will be ignored. 脚本中指定的电子邮件地址将被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM