你可能看到这样的错误:
You have entered an Invalid Field Value 13028543 for the following field: purchaseorder
Please enter value(s) for: PO, Item
Please enter value(s) for: Item
根据NetSuite提供的数据结构,必填字段是purchaseorder
, shipmentitem
。一般来说purchaseorder是PO的internalid,而shipmentitem如果填写item的internalid则会报错,因为这里实际指的是PO的lineuniquekey
分享一个例子,请替换ID、适当添加字段。
let recObj = record.create({
type: 'inboundshipment',
isDynamic: true
})
var purchaseorderSearchObj = search.create({
type: "purchaseorder",
filters:
[
["type", "anyof", "PurchOrd"],
"AND",
["internalid", "anyof", poId],
"AND",
["mainline", "is", "F"],
"AND",
["taxline", "is", "F"]
],
columns:
[
search.createColumn({ name: "lineuniquekey", label: "Item" })
]
});
let line = 0
purchaseorderSearchObj.run().each(function (result) {
recObj.selectLine({ sublistId: 'items', line: line })
recObj.setCurrentSublistValue({ sublistId: 'items', fieldId: 'purchaseorder', value: poId})
recObj.setCurrentSublistValue({ sublistId: 'items', fieldId: 'shipmentitem', value: result.getValue({name: 'lineuniquekey'}) })
recObj.commitLine({ sublistId: 'items' })
line++
return true;
});
const inShpId = recObj.save()
Comments