gpt4 book ai didi

javascript - 在将 netsuite 销售订单转换为履行时,您如何选择要履行的订单项?

转载 作者:行者123 更新时间:2023-12-05 04:47:26 25 4
gpt4 key购买 nike

尝试使用 NetSuite 销售订单转换

 var fulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: currentRecord.id,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});

收到错误“USER_ERROR”,“消息”:“您必须为此交易输入至少一个订单项。”

fulfillment 包含 7 个行项目,但在 fulfillment.save() 之后返回错误,即没有行项目添加到 fulfillment。

有没有办法选择要履行的行?想一想,在查看销售订单时,您如何点击 fulfill,然后点击您想要包含在该 fulfillment 中的行项目的复选框。

谢谢

最佳答案

有一个名为“itemreceive”的交易列字段。此“itemreceive”字段等同于 UI 中“项目履行创建记录”页面上的“履行”复选框。以下代码应该可以工作

//transform SO to create a new Item fulfillment
var fulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: currentRecord.id,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});

//get line count of newly created fulfillment
var lineCount = fulfillment.getLineCount({
sublistId: 'item'
});

//for each line set the "itemreceive" field to true
for (var i = 0; i < lineCount; i++) {
fulfillment.selectLine({
sublistId: 'item',
line: i
});
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
value: true
});

//set other relevant sublist fields
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'fieldId',
value: 'value'
});
fulfillment.commitLine({
sublistId: 'item'
});
}

//set any other relevant itemreceive fields
itemreceive.setValue({
filedId: 'fieldId',
value: 'value'
});

//save the newly created itemreceive
var itemreceiveId = itemreceive.save({
enableSourcing: true, //optional, defaul is false
ignoreMandatoryFields: true //optional, defaul is false
});

关于javascript - 在将 netsuite 销售订单转换为履行时,您如何选择要履行的订单项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68490597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com