我正在尝试使用他们的 Suitescript API 在 Netsuite 中按库存项目类别实现搜索。以下代码按预期工作,所以我知道我已经成功进行了远程通信。但我对如何按类别进行搜索感到困惑。
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));
}
这可以正常工作,但如果我取消注释该行:
new nlobjSearchFilter('internalid',null,'is','60635')
它不是。谁能指导我在 Suitescript 中按类别搜索项目?