Suitescript 2.0 - 如何在销售订单中获取特定产品SKU

时间:2017-07-23 07:29:28

标签: netsuite suitescript

我正在处理需要在销售订单中查找特定产品SKU的脚本。

订单是通过webservice API发出的,每次下订单时,我都需要搜索特定产品。

我确实查看过Suitescript 2.0 API文档,看来有两个选项供我调查:1 - 订单项,2 - 子列表

我想知道是否有人可以给我一些关于如何在suitecript 2.0上实现这一点的提示

1 个答案:

答案 0 :(得分:2)

以下是如何在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
    }
});
相关问题