Hello,
We are integrating our MES to Netsuite and send WOC to Netsuite as needed. Before we send WOC, we query how much qty is remaining for each item in inventory detail (so we do not get to negative qty).
I have the script mostly working except for lot number. The result I get is shown below and you can see inventorynumber is null.
[
{\"internalid\":\"1970\",\"item\":\"500-000009\",\"islotitem\":null,\"binnumber\":\"\",\"location\":null,\"inventorynumber\":null,\"expirationdate\":null,\"status\":\"\",\"onhand\":\"1200\",\"available\":null},
{\"internalid\":\"1971\",\"item\":\"500-000010\",\"islotitem\":null,\"binnumber\":\"\",\"location\":null,\"inventorynumber\":null,\"expirationdate\":null,\"status\":\"\",\"onhand\":\"600\",\"available\":null},
{\"internalid\":\"1973\",\"item\":\"501-000005\",\"islotitem\":null,\"binnumber\":\"\",\"location\":null,\"inventorynumber\":null,\"expirationdate\":null,\"status\":\"\",\"onhand\":\"16500\",\"available\":null},
{\"internalid\":\"1975\",\"item\":\"501-000007\",\"islotitem\":null,\"binnumber\":\"\",\"location\":null,\"inventorynumber\":null,\"expirationdate\":null,\"status\":\"\",\"onhand\":\"13500\",\"available\":null}
]
How I do is:
1) Create an Inventory Balance saved search
2) Create an Inventory Detail saved search
3) Find requested WO
4) Get Item Count for the WO and iterate on each item
var linecount=woc.getLineItemCount('item');
var itemid=woc.getLineItemValue('item','item',aj);
5) Find item name using InventoryBalance saved search
6) Use internalid for item to get inventory details (Inventory issued to the wo)
search=nlapiSearchRecord('InventoryDetail','customsearch2290',new nlobjSearchFilter('internalid','item','anyof',itemid));
7) Iterate on item list (which should be list of 1) and extract the following fields:
var inventorynumber=search[i].getValue('number','inventorydetail');
var expirationdate=search[i].getValue('expirationdate','item');
var status=search[i].getValue('status');
var onhand=search[i].getValue('quantity');
var available=search[i].getValue('stagedquantity');
In the UI i can see value for each othe above, but in script I only see value for onhand.
Any thoughts on how to extract the other information? The one I really care about is 'number' to get lot number.
Additionally, on UI if I click on lot number it shows quantity in KGs vs grams (shown above), and is there away to extract all the information in that (screenshot attached) e.g. Item, quantity, units, serial/lot number.
Thanks in advance.