How to GlideRecord a Table along with giving Pagination details and Orderby values as Queryparams.

Athuldas S
Kilo Contributor

I need to Query a Table Using Gliderecord functionality, along with giving pagination details.
while querying, I need it to be sorted by a choice field's Label (the choice field which resides within the table). 

I have tried orderBy(), sortBy(), chooseWindow(), setLimit(), setOffset(), setStart(). 
Is there any other way to do this.

6 REPLIES 6

The Machine
Kilo Sage

You might be able to do this with the Table API. Check out Rest Explorer and see if you can do it there. 

Zack Sargent
ServiceNow Employee
ServiceNow Employee

What went wrong with "chooseWindow()"? That seems to be the right fit ...

 

(See also: https://www.servicenow.com/community/developer-forum/flow-designer-version-of-this-pseudocode-glider...

Athuldas S1
Mega Contributor

"chooseWindow()" is working fine, It is fetching the records as per the offset & Limit.
But I need to Sort the records(using a choice field's label) first, then query the same using chooseWindow().
It is not working as expected.

Can you share the snip of code?

 

Are you trying to use all of those? You should just be able to use chooseWindow() without setLimit(), setOffset(), or setStart() ... I know this might be a dumb question, but I can't tell from your answer, so it's better to ask. 😎

 

Is the choice field also a table? Are the choices represented in their own table? If so, you might create a database view, join the tables, then sort the result. That might have more predictable behavior. (If not, you can probably create a small table to try this out.)