Reputation: 281
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');
}
}
}
Upvotes: 1
Views: 1084
Reputation: 21
You can try to view this articles https://netsuite.custhelp.com/app/answers/detail/a_id/27978/kw/Suitescript%20sublist%20subrecord/related/1 https://netsuite.custhelp.com/app/answers/detail/a_id/27977/kw/Suitescript%20sublist%20subrecord/related/1
I highly discouraged using 1.0 version of Netsuite. It will be unsupported soon and obsolete.
Upvotes: 2