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

Anil Lande
Kilo Patron

Hi,

You have to pass third parameter as 'true' in your 3rd line like  now_GR.chooseWindow(2, 4,true);

find_real_file.png

 

Because default value if false.

 

Thanks,

Anil Lande

 

Anurag Tripathi
Giga Patron

Its is working fine.

Run this and you will get the clarity

var now_GR = new GlideRecord('incident');
now_GR.orderBy('number');
now_GR.chooseWindow(2, 4);
now_GR.query();
while(now_GR.next())
{
gs.print('Number = '+ now_GR.number);
}
gs.log("count ="+now_GR.getRowCount());

Hi Anurag,

Do we need to include any user role to use this chooseWindow ? because its working through backend , but not through API call. 

backend execution - admin user

API execution - non admin user

 

Regards

Sagaya 

Role wouldn't matte with GlideRecord, it doesn't check for role.

If you want a role based GR then use GlideREcordSecure instead.