When performing the below inbound call on JSON API from browser on the incident table, we see an error with the exception -

"{"reason":null,"error":"String index out of range: -10"}" and the incident records were not retrieved in the browser results


 Inbound API Call:

https://<instance name>


Exception in the browser with the above Inbound call:



Issue reported on Kingston Patch 12 but the exception is irrelevant of the product version. It can trigger on any version if the table field types were not configured correctly



  • There exists a custom field named "xxxxx" on the task table which is of type counter for which the expected values should be date/time values.
  • It is observed that the values for this field on the task table ranges between 0 and 17 which are of type Integer. The platform code is expecting this to be a date/time value and does a substring starting at position 11.
  • Since the current integer values which you've got for this field were less than 11 characters( Not the Date/Time Values), you see an "String index out of range" exception when tried to query the incident table using JSON API 



The solution is to change the type of above mentioned  "xxxxx" custom field on task table from "counter" to "integer string" and then run the JSON call. This should retrieve the incident records in the browser results successfully.

Article Information

Last Updated:2019-08-02 20:52:47