sn-record-picker Pagination not supported for long query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2023 01:48 AM
Hello,
I have a sn-record-picker in a custom widget in service portal.
<sn-record-picker field="..." placeholder="..."
table="'...'" default-query="c.data.defaultQuery" value-field="'sys_id'"
search-fields="'name'" page-size="20" on-change="...">
</sn-record-picker>
The default query is in the form of
nameISNOTEMPTY^sys_idINsys_id1,sys_id2,sys_id3,...
When the default query gets too long I get the error 400 Bad Request
{"error":{"message":"Pagination not supported","detail":"The requested query is too long to build the response pagination header URLs. Please do one of the following: shorten the sysparm_query, or query without pagination by setting the parameter 'sysparm_suppress_pagination_header' to true, or set 'sysparm_limit' with a value larger then 75 to bypass the need for pagination."},"status":"failure"}
If I change page size to e.g. 10000 it works fine, but then we do not have pagination.
KB0793923 seems similar but it shows that it has been fixed in Paris and we are in Tokyo.
I'd appreciate any idea about how to make this to work with pagination.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2023 10:59 PM
To fix this issue in ServiceNow Tokyo, you can try one of the following options:
Shorten the sysparm_query by including fewer sys_id values in the IN clause.
Set the parameter 'sysparm_suppress_pagination_header' to true to query without pagination.
Set 'sysparm_limit' with a value larger than 75 to bypass the need for pagination.
Alternatively, you can try using the glide-record getIn clause to get all the sys_ids in a single query, rather than using a large IN clause. This should allow you to retrieve all the records without encountering the 400 Bad Request error.
Kindly mark the response as Correct or Helpful.
Cheers,
Anish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 01:33 AM
Can you explain what is glide-record getIn clause you mentioned in Alternate solution.