How to retrieve case historical data and sla in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 08:08 AM
Hi everyone,
I have a requirement to retrieve case historical data, along with SLA data, in ServiceNow. However, I am facing challenges due to the large volume of data in the related tables, which is affecting Rest API performance.
Has anyone implemented a similar solution before or integrated such data with external systems? Any suggestions on best practices or optimization techniques for handling large data volumes in such integrations would be greatly appreciated.
Thanks in advance..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 08:12 PM - edited 09-27-2024 08:13 PM
Hi @lucky6!
ServiceNow recommends exporting large data sets in chunks to avoid performance issues. For this, you can implement pagination in your REST API calls.
By default, the limit is 10,000 records per call, but you can manage this using the sysparm_limit and sysparm_offset parameters. For example, the first call would retrieve the first 10,000 records, and the second call would use an offset to get the next set:
First call:
/api/now/table/your_table?sysparm_limit=10000&sysparm_offset=0&sysparm_query=ORDERBYsys_created_on
Second call:
/api/now/table/your_table?sysparm_limit=10000&sysparm_offset=10000&sysparm_query=ORDERBYsys_created_on
Continue adjusting the offset in subsequent calls to retrieve more records.
However, be cautious about increasing sysparm_limit too high, as it may lead to timeouts due to REST API transaction quotas (default is 60 seconds per transaction).
This approach should help improve performance and make data retrieval more manageable.
If my answer helped you in any way, please mark it as Helpful / Accepted Solution 🎯
Regards,
Isaac Vicentini.
MVP 2025 ✨
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 09:11 PM
Hi @Isaac Vicentini ,
Thank you for your response. I tried the same approach, but the issue is that since we are querying two tables in the REST API, it is timing out when there are more than 8,000 records. Even with a smaller volume, it takes about 3 minutes to fetch the data."
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2024 11:38 AM
@lucky6, Its strange that it takes so long, but if you believe that this delay is due to querying more than one table, I suggest you try creating an API using GraphQL. With GraphQL Resolvers you can specify exactly what you need in the return and that can help you gain performance.
After that, if necessary, there is the possibility of building an API using GraphQL that is paged, so you will achieve the maximum possible performance.
First of all, I advise you to investigate whether there is a way to improve the performance of your current API, using the available parameters such as:
sysparm_query: To bring only relevant records.
sysparm_fields: To return only relevant fields.
sysparm_limit: To limit the number of records per page.
sysparm_offset: To ignore pages that have already been returned.
If thats not enough, see more about the GraphQL solution, I will be leaving some important links here:
Youtube: GraphQL Create an API Intro - Learn Integrations on the Now Platform
Article: Getting Started - GraphQL API framework
Playground:
If my answer helped you in any way, please mark it as Helpful / Accepted Solution 🎯
Regards,
Isaac Vicentini.
MVP 2025 ✨
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 06:27 AM
Hi @lucky6!
Let me know if it worked and which way you took 🙂
MVP 2025 ✨