无法确定 Scheduled Suitescript 评估错误的原因
Unable to identify cause of Evaluation Error on Scheduled Suitescript
早上好,Braindead 新手来了
我有一个无法加载到 Netsuite 中的 Suitescript - 缺少一些我无法确定的东西
到目前为止,我只使用了一个评估工具,一切都清楚了,但 Suitescript Debugger 发现了一个错误,我无法找到原因
/**
@NApiVersion 2.0
@NScriptType ScheduledScript
*/
define(['N/task', 'N/runtime'], function(task, runtime) {
/**
* Reschedules the current script and returns the ID of the reschedule task
*/
function rescheduleCurrentScript() {
var scheduledScriptTask = task.create({
taskType: task.TaskType.SCHEDULED_SCRIPT
});
scheduledScriptTask.scriptId = runtime.getCurrentScript().id;
scheduledScriptTask.deploymentId = runtime.getCurrentScript().deploymentId;
return scheduledScriptTask.submit();
}
function execute(context) {
// Do stuff
var myPurchaseOrderSearch = s.create({
transaction.type: 'purchaseorder',
columns: [{
name: 'transaction.internalid',
summary: COUNT
}],
filters: [{
name: 'transaction.mainline',
operator: 'is',
values: ['T']
}, {
name: "transaction.trandate",
operator: "within",
values: ["previousoneyear"]
}]
});
myPurchaseOrderSearch.run().each(function (result) {
var CountPO = parseInt(result.getValue({
"name": "transaction.internalid",
"summary": s.Summary.COUNT
}), 10);
return true;
});
return results;
var SetDaysBtwn = (365/ CountPO).toFixed(2);
nlapiSetFieldValue('custentity81', SetDaysBtwn);
}
}
}
// Check remaining usage and reschedule if necessary
if (runtime.getCurrentScript().getRemainingUsage() < 100) {
var taskId = rescheduleCurrentScript();
log.audit("Rescheduling status: " + task.checkStatus(taskId));
return;
}
}
return {
execute: execute
};
});
很抱歉成为上传他整个脚本的混蛋,但这返回了错误:"missing : after property id (adhoc$-1$debugger.user#25)" 作为一个白痴,我无法将其固定在任何地方。如果有人能提供帮助,将不胜感激,谢谢!
您的 myPurchaseOrderSearch
中存在语法错误。 transaction.type
属性 名称无效。它应该只是 type
.
我不确定您使用什么来编写代码,但是使用正确的 IDE FWIW 将有助于轻松识别此类错误。我将您的代码复制并粘贴到 WebStorm 中,它立即以鲜红色突出显示错误。
早上好,Braindead 新手来了 我有一个无法加载到 Netsuite 中的 Suitescript - 缺少一些我无法确定的东西
到目前为止,我只使用了一个评估工具,一切都清楚了,但 Suitescript Debugger 发现了一个错误,我无法找到原因
/**
@NApiVersion 2.0
@NScriptType ScheduledScript
*/
define(['N/task', 'N/runtime'], function(task, runtime) {
/**
* Reschedules the current script and returns the ID of the reschedule task
*/
function rescheduleCurrentScript() {
var scheduledScriptTask = task.create({
taskType: task.TaskType.SCHEDULED_SCRIPT
});
scheduledScriptTask.scriptId = runtime.getCurrentScript().id;
scheduledScriptTask.deploymentId = runtime.getCurrentScript().deploymentId;
return scheduledScriptTask.submit();
}
function execute(context) {
// Do stuff
var myPurchaseOrderSearch = s.create({
transaction.type: 'purchaseorder',
columns: [{
name: 'transaction.internalid',
summary: COUNT
}],
filters: [{
name: 'transaction.mainline',
operator: 'is',
values: ['T']
}, {
name: "transaction.trandate",
operator: "within",
values: ["previousoneyear"]
}]
});
myPurchaseOrderSearch.run().each(function (result) {
var CountPO = parseInt(result.getValue({
"name": "transaction.internalid",
"summary": s.Summary.COUNT
}), 10);
return true;
});
return results;
var SetDaysBtwn = (365/ CountPO).toFixed(2);
nlapiSetFieldValue('custentity81', SetDaysBtwn);
}
}
}
// Check remaining usage and reschedule if necessary
if (runtime.getCurrentScript().getRemainingUsage() < 100) {
var taskId = rescheduleCurrentScript();
log.audit("Rescheduling status: " + task.checkStatus(taskId));
return;
}
}
return {
execute: execute
};
});
很抱歉成为上传他整个脚本的混蛋,但这返回了错误:"missing : after property id (adhoc$-1$debugger.user#25)" 作为一个白痴,我无法将其固定在任何地方。如果有人能提供帮助,将不胜感激,谢谢!
您的 myPurchaseOrderSearch
中存在语法错误。 transaction.type
属性 名称无效。它应该只是 type
.
我不确定您使用什么来编写代码,但是使用正确的 IDE FWIW 将有助于轻松识别此类错误。我将您的代码复制并粘贴到 WebStorm 中,它立即以鲜红色突出显示错误。