我试图从 SuiteScript 2.0 中的分页搜索中获取最后 200 个结果。当我运行简单的代码时,我得到了错误
"name":"INVALID_PAGE_RANGE","message":"无效的页面范围:获取。"
我到底做错了什么?
以下代码在 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;
});