[英]Netsuite - How to enter sublist items using a restlet
我收到一个错误
{'error': {'code': 'JS_EXCEPTION',
'message': 'org.mozilla.javascript.EcmaError: TypeError: Cannot find function selectNewLine in object standard record. (/SuiteScripts/NS Tests 2.js#67)'}}
关于尝试使用 restlet 创建销售订单记录。
我的代码如下。 我怎样才能让它工作?
/**
* @NApiVersion 2.0
* @NScriptType Restlet
* @NModuleScope SameAccount
*/
define([
'N/record',
], function(record) {
function doPost(data){
var recordObj = record.create({
type: "salesorder",
is_dynamic: true
});
var customer = data.customer;
var tech = data.tech;
var items = data.items;
recordObj.setValue({
fieldId:'entity',
value:customer
});
recordObj.setValue({
fieldId:'salesrep',
value:tech
});
for (i = 0; i < items.length; i++) {
recordObj.selectNewLine({
sublistId: 'item'
});
recordObj.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: items[i][0]
});
recordObj.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: items[i][1]
});
recordObj.commitLine({
sublistId:'item'
});
}
var recordId = recordObj.save({
enableSourcing: false,
ignoreMandatoryFields: false
});
return recordId;
}
return {post:doPost};
});
您的is_dynamic
应该是isDynamic
in record.create()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.