Item Location Configuration search

// search for item location configuration using itemid and get the supplytype of the location
function itemLocConfigSearch(itemId){
    try {
        let supplytypeItemobj = {};
        let itemSearch = search.create({
            type: record.Type.ITEM_LOCATION_CONFIGURATION,
            filters:
                [
                    ['item', 'is', itemId]
                ],
            columns:
                [
                    search.createColumn({name: "supplytype", label: "Supply Type"})
                ]
        });
        let searchResultCount = itemSearch.runPaged();
        searchResultCount.pageRanges.forEach(function (pageRange)
        {
            let myPage = searchResultCount.fetch({ index: pageRange.index });
            myPage.data.forEach(function (result)

            {
                supplytypeItemobj.supplyType=result.getValue({
                    name: 'supplytype'
                });
            })

        });
        return supplytypeItemobj;
    }catch (e) {
        log.debug("Error @ function",e)
    }

}

Leave a comment

Your email address will not be published. Required fields are marked *