- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:13 AM
Hi everyone,
I've created a REST API Script that allows me to get records from my incident table. However, we would like to use pagination so that if we have a multitude of records, we are able to page through and not have a massive amount of data in one call. From what I've been finding, using a combination of sysparm_limit and sysparm_offset is the best way to go to have something that is similar to pagination. Since I'm using a script instead of the REST API Explorer to create my objects, I haven't been able to find anything that allows to use something similar to sysparm_offset. The script I have set up creates the JSON object since I have to do calls into multiple tables to get certain values. To substitute sysparm_limit, I found that I can use gr.setLimit(10000) as an example since that's part of the glide record functionality. There was a previous post that had said about using gr.Window(10, 20) or something along those lines, I'm not 100% sure. I know that I can get sysparm_offset as a queryParam, but what to do with it from there, I'm not sure. If someone could point me in the right direction, that would be great! Thanks!
Eric
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:17 AM
Hi Eric,
I couldn't find it in the documentation, but other community articles seem to point to this solution.
gr.chooseWindow(10, 20); // this will give you 10 records, starting form the 11th to 20th.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2018 11:51 AM
Thank you! It was helpful 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2019 10:22 AM
Hi Eric,
did you had to create query parameters by going to system web service> scripted REST API>query parameters ? to use the variables you mentioned above?
var offset = request.queryParams.offset,
limit = request.queryParams.limit,