你是對的,你將使用N/search
。它使用類似於API的nlapiCreateSearch
的1.0 API。
您將使用search.create
構建您的搜索對象或search.load
加載保存的搜索。然後你將在結果搜索對象上調用run
。最後,你可以用兩種方式處理結果:
- 使用
each
方法和回調
- 使用
getRange
方法來獲取特定數量的結果 的
在下面的例子中,我已將N/search
導入我的模塊中作爲s
,並顯示了each
方法的用法。
function findCustomers() {
// Create and run search
s.create({
"type": "customer",
"filters": [
['isinactive', s.Operator.IS, 'F'], 'and',
['company', s.Operator.NONEOF, ['123','456']
],
"columns": ['email', 'firstname', 'lastname']
}).run().each(processCustomer);
}
function processCustomer(result) {
// do something with Customer search result
// returns a boolean; true to continue iterating, false to stop
return true;
}
https://netsuite.custhelp.com/app/answers/detail/a_id/43702/kw/N%2Fsearch – W3BGUY