I need to just get the Qty on hand, qty on order, qty backordered, under which bin number the item is, value and avg. cost of an item. Just need to show this to my manager in a normal text field.
I tried to do it from search, but the values were not according to the inventory details.
My manager is saying me not to use search and use loading the subrecords but i couldn't find any idea for loading subrecords.
My Current code on client script:
function pageInit() {
var itemSearch = nlapiSearchRecord("item", null,
[
["name", "haskeywords", "ZE001156"],
],
[
new nlobjSearchColumn("itemid").setSort(false),
new nlobjSearchColumn("displayname"),
new nlobjSearchColumn("location"),
new nlobjSearchColumn("quantityonhand"),
new nlobjSearchColumn("quantityonorder"),
new nlobjSearchColumn("quantitybackordered"),
new nlobjSearchColumn("averagecost"),
new nlobjSearchColumn("binnumber")
]
);
nlapiLogExecution('DEBUG', 'itemSearch', JSON.stringify(itemSearch));
nlapiLogExecution('DEBUG', 'itemSearch.length', itemSearch.length);
if (itemSearch.length > 0) {
for (var i = 0; i < itemSearch.length; i++) {
var srchLine = itemSearch[i];
var onHand = srchLine.getValue('quantityonhand');
nlapiLogExecution('DEBUG', 'on hand:' + i, onHand);
var onOrder = srchLine.getValue('quantityonorder');
}
}
}
question from:
https://stackoverflow.com/questions/65885283/how-to-access-the-inventory-details-of-an-item-master-record-using-suitescript-1 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…