Search code examples
jsonsoaplegacyservicenow

Servicenow - How to limit the number of records in Legacy:JSON


After reading this http://wiki.servicenow.com/index.php?title=Legacy:JSON_Web_Service#getRecords

Following were tried

Base URL: https://my_server.service-now.com/

  • /incident.do?JSON&sysparm_action=getRecords&sysparm_force_row_count=3
  • /incident.do?JSON&sysparm_action=getRecords&sysparm_query=3
  • /incident.do?JSON&sysparm_action=getRecords&sysparm_record_count=3

But every time, returns the all available records for that user.

We are using RetroFit to consume the ServiceNow webservices.


Solution

  • Out of the box, there's no way to limit the legacy JSON processor via request parameters. There is a global property you can set, but that limits rowcount for every request.

    However, the JSONProcessor is just a script include (you can find it by name) that you can modify from within the target instance to add this behavior, and this article on the ServiceNow community provides an example: https://community.servicenow.com/thread/150482