The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Retrieve "chooseWindow" attribute from a GlideRecord object

RaysOdyssey
Tera Contributor

Hello,
I am wondering if there is a way to retrieve "chooseWindow" attribute from a GlideRecord object.
Consider this scenario:
A widget is doing a GlideRecord query to grab some records from a table. It instantiates a gliderecord like this:

 

 

var gr = new GlideRecord('customer_contact');
gr.addEncodedQuery('active=true');
gr.chooseWindow(0, 19); // this would mean grab first 20 records
gr.query();

 


Now, I am able to get the query by running

 

gr.getEncodedQuery();

 


Is there any way to retrieve window size from this GlideRecord object as well?


ALTERNATIVELY:

Is there any way to remove the current encoded query from the gliderecord object and add a new one without re-initializing the object. Something like

 

gr.removeQuery();
gr.addEncodedQuery('active=true^accountISNOTEMPTY');

 


So far the only way I have found to remove the existing query is

 

gr.initialize();

 


But Initializing the gr removes the Window values as well.

2 REPLIES 2

Manmohan K
Tera Sage

Hi @RaysOdyssey 

 

You can use getRowCount to get the window Size set on GlideRecord

 

gr.getRowCount();

 

Hi @Manmohan K ,

Thank you for your response.

From what I understand, getRowCount() would only return the number of rows that were requested?

 

For example:

gr.chooseWindow(0, 19); // should return 20 for gr.getRowCount();

gr.chooseWindow(20, 39); // will also return 20 for gr.getRowCount();

The main issue is to get the "pagination" values being requested by the widget on query.

Please correct me if my understanding is wrong.

 

Thank you!