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?
Take the quotes off of the internal id number. The search filter for internalid is looking for a number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With