无法进站运输
{
type: "error.SuiteScriptError",
name: "SSS_INVALID_SUBLIST_OPERATION",
message: "You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
stack: [
"anonymous(N/serverRecordService)",
"inboundResults(/SuiteScripts/inboundResults.js:40)"
],
cause: {
type: "internal error",
code: "SSS_INVALID_SUBLIST_OPERATION",
details: "You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
userEvent: null,
stackTrace: [
"anonymous(N/serverRecordService)",
"inboundResults(/SuiteScripts/inboundResults.js:40)"
],
notifyOff: false
},
id: "",
notifyOff: false,
userFacing: false
}
var objRecord1 = record.load({
type:"receiveinboundshipment",
id: 2,
isDynamic:true
});
var receiveItemCount=objRecord1.getLineCount('receiveitems');
var lineNum = objRecord1.selectLine({
sublistId: 'receiveitems',
line: 2
});
objRecord1.setCurrentSublistValue({
sublistId: 'receiveitems',
fieldId: 'receiveitem',
value: true,
ignoreFieldChange: true
});
objRecord1.setCurrentSublistValue({
sublistId: 'receiveitems',
fieldId: 'quantitytobereceived',
value: 1,
ignoreFieldChange: true
});
objRecord1.commitLine({
sublistId: 'item'
});
var recordId3 = objRecord1.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
答案 0 :(得分:2)
记录 receiveinboundshipment 是可以从脚本访问的,并且 receiveitem 和 tobereceived 字段正确。
唯一不正确的是,您正在对项目子列表进行提交,而不是对 receiveitems 。
objRecord1.commitLine({
sublistId: 'receiveitems'
});
您应该将子列表“ item”替换为“ receiveitems”,并且应该可以使用。
祝你好运