Suitescript 2.0 - 如何在销售订单中获取特定产品 SKU
Suitescript 2.0 - how to get a particular product SKU within a Sales Order
我正在编写需要在销售订单中查找特定产品 SKU 的脚本。
通过网络服务下订单API,每次下订单,我都需要搜索特定的产品。
我查看了 Suitescript 2.0 API 文档,似乎有两个选项供我研究:1 - 行项目,2 - 子列表
我想知道是否有人可以给我一个关于如何在 suitescript 2.0 上实现这一点的提示
下面是如何在 SS2.0 中查找一行。
// Finding a specific line item in SuiteScript 2.0...
require(["N/record"], function (r) {
var rec = r.load({
"type": r.Type.SALES_ORDER,
"id": 123
});
// Find the line that contains item 777
var index = rec.findSublistLineWithValue({"sublistId": "item", "fieldId": "item", "value": 777});
// find returns -1 if the item isn't found
if (index > -1) {
// we found it on line "index"
} else {
// item 777 is not in the list
}
});
我正在编写需要在销售订单中查找特定产品 SKU 的脚本。
通过网络服务下订单API,每次下订单,我都需要搜索特定的产品。
我查看了 Suitescript 2.0 API 文档,似乎有两个选项供我研究:1 - 行项目,2 - 子列表
我想知道是否有人可以给我一个关于如何在 suitescript 2.0 上实现这一点的提示
下面是如何在 SS2.0 中查找一行。
// Finding a specific line item in SuiteScript 2.0...
require(["N/record"], function (r) {
var rec = r.load({
"type": r.Type.SALES_ORDER,
"id": 123
});
// Find the line that contains item 777
var index = rec.findSublistLineWithValue({"sublistId": "item", "fieldId": "item", "value": 777});
// find returns -1 if the item isn't found
if (index > -1) {
// we found it on line "index"
} else {
// item 777 is not in the list
}
});