We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

GlideRecord chooseWindow is not working

Sagaya1
Giga Expert

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.

find_real_file.png

Regards

sagaya 

6 REPLIES 6

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 :

find_real_file.png

API output

find_real_file.png

Regards

Sagaya 

Sagaya1
Giga Expert

Hi Anurag,

 

Identified the issue. I use setLimit in the query , it has suppress the chooseWindow operation.

Issue has resolved .

Regards

Sagaya