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

Netsuite Suitescript 2.0-如何在销售订单中获取特定的产品SKU,netsuite,suitescript,Netsuite,Suitescript,我正在编写一个脚本,需要在销售订单中查找特定的产品SKU 订单是通过webservice API下的,每次下订单时,我都需要搜索特定的产品 我确实看过SuiteScript2.0API文档,它似乎有两个选项供我研究:1-行项目,2-子列表 我想知道是否有人能给我一个提示,告诉我如何在SuiteScript2.0上实现这一点 // Finding a specific line item in SuiteScript 2.0... require(["N/record"], function (r

我正在编写一个脚本,需要在销售订单中查找特定的产品SKU

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

我确实看过SuiteScript2.0API文档,它似乎有两个选项供我研究:1-行项目,2-子列表


我想知道是否有人能给我一个提示,告诉我如何在SuiteScript2.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
    }
});

下面是如何在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
    }
});

令人惊叹的!非常感谢@Adolfo Garzao,太棒了!非常感谢@Adolfo Garza