-
StackOverflow 文档
-
netsuite 教程
-
执行搜索
-
SS 2.0 Ad Hoc Search
require(['N/search'], function(SEARCHMODULE){
var type = 'transaction';
var columns = [];
columns.push(SEARCHMODULE.createColumn({
name: 'internalid'
}));
columns.push(SEARCHMODULE.createColumn({
name: 'formulanumeric',
formula: '{quantity}-{quantityshiprecv}'
}));
var salesOrdersArray = [123,456,789];
var filters = [];
filters.push(['type', 'anyof', 'SalesOrd']);
filters.push('and');
filters.push(['mainline', 'is', 'F']);
filters.push('and');
filters.push(['internalid', 'anyof', salesOrdersArray]);
var mySearchObj = {};
mySearchObj.type = type;
mySearchObj.columns = columns;
mySearchObj.filters = filters;
var mySearch = SEARCHMODULE.create(mySearchObj);
var resultset = mySearch.run();
var results = resultset.getRange(0, 1000);
for(var i in results){
var result = results[i];
var row = {};
for(var k in result.columns){
log.debug('Result is ' + result.getValue(result.columns[k])); //Access result from here
}
}
});