I am trying to implement a search by Category of Inventory Items in Netsuite using their Suitescript API. The following code works as expected so I know I have successful remote communication. But I am stumped as to how to go about searching by Category.
function NSTest() {
var items = [];
var filters = [
//new nlobjSearchFilter('price',null,'lessthan','20'),
new nlobjSearchFilter('thumbnailurl',null,'isnotempty')
//new nlobjSearchFilter('internalid',null,'is','60635')
];
var columns = [
new nlobjSearchColumn('itemid'),
new nlobjSearchColumn('salesdescription'),
new nlobjSearchColumn('storedisplaythumbnail'),
new nlobjSearchColumn('baseprice')
];
var results = nlapiSearchRecord('inventoryitemdetail',null,filters,columns);
for(var i=0,l=results.length; i < l; i++) {
var result = results[i];
var price = result.getValue('baseprice');
var thumbImage = result.getText('storedisplaythumbnail');
var desc = result.getValue('salesdescription');
var name = result.getValue('itemid');
var img = 'http://shopping.netsuite.com'+thumbImage;
var item = {desc:desc, price:price, name:name, img:img};
items.push(item);
}
response.write(JSON.stringify(items));
}
This works correctly but if I uncomment the line:
new nlobjSearchFilter('internalid',null,'is','60635')
it does not. Can anyone guide me toward searching items by category in Suitescript?