GlideRecord chooseWindow is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2021 04:38 AM
Hi,
I am trying to use chooseWindow in my GlideRecord and control the retrieve count. It was working 3 months back but now its not working .
Please help to resolve this issue.
Code :
var now_GR = new GlideRecord('incident');
now_GR.orderBy('number');
now_GR.chooseWindow(2, 4);
now_GR.query();
gs.log("count ="+now_GR.getRowCount());
output : Instead of count =2 , i am getting whole record count.
Regards
sagaya
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2021 12:38 AM
Hi Anurag,
If its not depend on role , how the same code is working fine through background and not working through REST API call? could you please help to fix ?
code:
var resp = [];
var int_start_record=0;
var pagination_records =3;
var caseGr = new GlideRecord('case');
caseGr.addQuery('account.number', '1234');
caseGr.orderBy('number');
caseGr.chooseWindow(int_start_record, pagination_records);
caseGr.query();
gs.log("count ="+caseGr.getRowCount());
while (caseGr.next()) {
gs.info("case number=" + caseGr.number);
var glRU = new GlideRecordUtil();
var file_list = glRU.getFields(caseGr);
var accDtl = {};
file_list.forEach(function(element) {
accDtl[element] = caseGr.getDisplayValue(element);
});
resp.push(accDtl);
var responseData = JSON.stringify(resp);
}
gs.info("responseData =" + responseData );
Background output :
API output
Regards
Sagaya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2021 07:56 AM
Hi Anurag,
Identified the issue. I use setLimit in the query , it has suppress the chooseWindow operation.
Issue has resolved .
Regards
Sagaya