获取 Netsuite 中子列表的名称?
Get the name of a sublist in Netsuite?
有没有办法在 Netsuite 中获取子列表的名称?我正在使用新的 Inbound Shipment 部分,我需要通过 restlet 向其中添加项目。每次尝试时,我都会收到此错误:
{"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/recordService)","<anonymous>(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:57)","doPost(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:34)"],"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/recordService)","<anonymous>(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:57)","doPost(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:34)"],"notifyOff":false},"id":"","notifyOff":false}"
这就是我尝试访问它的方式:
var rec =
r.create({
type: "inboundshipment",
isDynamic: true,
defaultValues: null
}).setValue({
fieldId: "externalid",
value: e.id,
ignoreFieldChange: false
});
var i = 1;
/******/
//Here is where you are adding a new line.
/******/
rec.selectNewLine({
sublistId: 'item'
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'po',
value: "13193"
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: "79760"
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: 2
});
我认为子列表 ID 可能不正确,但我不知道它应该是什么。我试过 items、inbounditems、inboundshipmentitems,它们都给我同样的错误。我尝试以同样的方式创建一个销售订单并尝试向其中添加项目,并且它工作正常,所以我认为它只是子列表 ID。有人知道如何提供帮助吗?
您可以使用 Record.getSublists() 检索子列表 ID 并记录下来以确保您拥有有效的子列表 ID。
我怀疑这可能与 SuiteScript 2.0 错误有关,因此请与 NetSuite 联系并尝试在 SuiteScript 1.0 中重写它。
有没有办法在 Netsuite 中获取子列表的名称?我正在使用新的 Inbound Shipment 部分,我需要通过 restlet 向其中添加项目。每次尝试时,我都会收到此错误:
{"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/recordService)","<anonymous>(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:57)","doPost(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:34)"],"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/recordService)","<anonymous>(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:57)","doPost(/SuiteScripts/KK_Sandbox_Scripts_SD/RestLets/InboundShipment.js:34)"],"notifyOff":false},"id":"","notifyOff":false}"
这就是我尝试访问它的方式:
var rec =
r.create({
type: "inboundshipment",
isDynamic: true,
defaultValues: null
}).setValue({
fieldId: "externalid",
value: e.id,
ignoreFieldChange: false
});
var i = 1;
/******/
//Here is where you are adding a new line.
/******/
rec.selectNewLine({
sublistId: 'item'
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'po',
value: "13193"
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: "79760"
});
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: 2
});
我认为子列表 ID 可能不正确,但我不知道它应该是什么。我试过 items、inbounditems、inboundshipmentitems,它们都给我同样的错误。我尝试以同样的方式创建一个销售订单并尝试向其中添加项目,并且它工作正常,所以我认为它只是子列表 ID。有人知道如何提供帮助吗?
您可以使用 Record.getSublists() 检索子列表 ID 并记录下来以确保您拥有有效的子列表 ID。
我怀疑这可能与 SuiteScript 2.0 错误有关,因此请与 NetSuite 联系并尝试在 SuiteScript 1.0 中重写它。