- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2019 02:34 PM
I need to limit the number of records returned to my "Data Table from Instance" widget (not the page size), but there doesn't seem to be an option for this. I have hundreds of records in the widget and want to limit it to 100.
I cloned it and the widget it loads (Data Table). Inside the server script for the cloned data table widget, I added this:
gr.setLimit(100);
But now instead of returning hundreds of records, it returns 20!
Please help.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 05:06 AM
I was trying to prevent the possibility of a widget returning 10's of thousands of records. It looks like that won't be an actual problem, since the widget runs a "get row count" query and fetches only the "page size" number of records to initially display. So far it's working with large numbers of results. I was just confused about the lack of support for the query modifier "setLimit()". I guess we can live without it though.
Thanks for your input.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2019 02:36 PM
you can update default number of rows for list.
Please check below for updating row count.
https://docs.servicenow.com/bundle/helsinki-platform-user-interface/page/use/using-lists/task/t_CustmNumListRowsPerPg.html
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2019 05:59 AM
Hi Sachin, I'm actually working with a portal widget - not in the platform. Also I'm trying to limit the total number of records returned by the query, not the number of records per page.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2019 06:53 AM
In data table widget below line is limiting number of records to 20
var windowSize = data.window_size || $sp.getValue('maximum_entries') || 20;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 05:06 AM
I was trying to prevent the possibility of a widget returning 10's of thousands of records. It looks like that won't be an actual problem, since the widget runs a "get row count" query and fetches only the "page size" number of records to initially display. So far it's working with large numbers of results. I was just confused about the lack of support for the query modifier "setLimit()". I guess we can live without it though.
Thanks for your input.