[英]Can't upload file to SuiteScript
I am trying to upload a Map/reduce type script to netsuite following a suitescript 2.0 training guide.我正在尝试按照suitescript 2.0培训指南将Map/reduce类型脚本上传到netsuite。 I am receiving the following error: " SuiteScript 2.0 entry point scripts must implement one script type function ."我收到以下错误:“ SuiteScript 2.0 入口点脚本必须实现一种脚本类型函数。”
I'm using the getInputData() and map() functions.我正在使用 getInputData() 和 map() 函数。 Returning a reference object pointing to a saved search.返回指向已保存搜索的参考对象。 Then extracting and logging the context value and the parsed context value (comparing json strings and js objects in the lesson).然后提取并记录上下文值和解析的上下文值(比较课程中的 json 字符串和 js 对象)。
Anyone see a syntax error, know what I might be missing, or what I can test for?任何人都看到语法错误,知道我可能遗漏了什么,或者我可以测试什么?
/**
* @NApiVersion 2.x
* @NScriptType MapReduceScript
*/
define(['N/search']),
function(search) {
function getInputData() {
return { type: 'search', id: 'customsearch_iii_payments' };
}
function map(context) {
var jsonResult = context.value
var searchResult = JSON.parse(context.value);
log.debug('JSON result' + jsonResult);
log.debug('Search Result' + searchResult);
}
return {
getInputData: getInputData,
map: map
}
}
It was a netsuite specific syntax error my linter didn't catch.这是我的 linter 没有发现的特定于网络套件的语法错误。 My script definition wasn't wrapping the entire script, just the module declarations.我的脚本定义没有包装整个脚本,只是模块声明。
/**
* @NApiVersion 2.x
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
*/
define(['N/search'],
function(search) {
function getInputData() {
return { type: 'search', id: 'customsearch_iii_payments' };
}
function map(context) {
var jsonResult = context.value
var searchResult = JSON.parse(context.value);
log.debug('JSON result' + jsonResult);
log.debug('Search Result' + searchResult);
}
return {
getInputData: getInputData,
map: map
}
});
还要检查@NScriptType 符号,如果您有ScheduleScript,无论语法是否正确,netsuite 都希望您在返回对象上有一个名为“execute”的函数。
I found the issue for me was that my script referenced local files which I hadn't yet uploaded.我发现我的问题是我的脚本引用了我尚未上传的本地文件。
Upload other local files before creating a script record.在创建脚本记录之前上传其他本地文件。
double check for the require
vs define
keyword in the main method definition.仔细检查主方法定义中的require
与define
关键字。 2.X ScheduledScript
use define
2.X ScheduledScript
使用define
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.