Discussions
quantityonhand
hi Ug,
Please can someone tell me what i'm not calling right in this script below?I want to get the quantityonhand of an item in a given location, using search.
Here's the script:
var loc=nlapiGetFieldValue('custrecord_locations');
var item=nlapiGetFieldValue('custrecord_items');
var filters = new Array();
filters[0] = new nlobjSearchFilter('internalid', null, 'equalTo', item);
filters[1] = new nlobjSearchFilter('inventorylocation', null, 'equalTo', loc);
var column= new nlobjSearchColumn('locationquantityonhand', loc)
var searchResults = nlapiSearchRecord('inventoryitem',null,filters,column);
var onHand = searchResults[0].getValue('locationquantityonhand', loc,'sum');.........................
the itemid and locationid are sourced from a customrecord and used in performing the search.I can't figure out what's wrong because the script isn't running the search.Any suggestion on this or any other way to get the 'quantityonhand' for an inventoryitem would be helpful.