1
我試圖從SuiteScript 2.0中的分頁搜索中獲取最後200個結果。當我運行簡單代碼時出現錯誤從頁面搜索中提取最後n個結果
「name」:「INVALID_PAGE_RANGE」,「message」:「無效的頁面範圍:fetch。」
我究竟做錯了什麼?
下面的代碼是在NS調試器(我已刪除了簡潔一些代碼)運行:
function(ui, email, runtime, search, file, config, format, record, log) {
var mySearch = search.load({
id: 'customsearch_mht_lrf_export_to_lab'
});
// 200 results per page (am I correct here?)
var results = mySearch.runPaged({pageSize:200});
var count = results.count; // = 264
// Obtain the last 200 results. From the documentation;
// index is 'The index of the page range that bounds the desired data.'
// Error occurs on the next line
var data = results.fetch({index: results.count});
var x = 0;
});