ICD Analytics API returns empty dataset when filtering by custom wrap-up code

The ServiceNow script include is hitting POST /api/v2/analytics/icd/details to pull interaction metadata for incident categorization. The request completes with a 200 OK, but the data array comes back completely empty. This is happening consistently for interactions tagged with our custom “Tier2_Escalation” wrap-up code.

Here is the breakdown of what was tested:

  • Dropped the wrapup filter from the request body. Data returns instantly.
  • Verified the wrap-up code ID via GET /api/v2/interaction/wrapupcodes. The ID matches exactly.
  • Checked the OAuth token scope. Has analytics:icd:read and interaction:read.
  • Ran the same payload against the sandbox org. Works fine there.
  • Inspected the response headers. X-Request-Id is present, no warnings.
  • Tried querying the GET /api/v2/interactions/{id} endpoint directly for a known interaction with this wrap-up. The wrapup object populates correctly there.
  • Reviewed the API audit logs for the specific X-Request-Id. No throttling or backend errors recorded.

The issue seems isolated to the production environment when that specific filter is active. The ServiceNow side is throwing a “No data found” error in the script log, which forces the incident to default to a generic category. We’ve got about 400 incidents a day routing wrong because of this. The downstream automation relies on the ICD response to set the category field. The queue manager is already complaining about the ticket routing delays.

The ServiceNow instance is running Washington DC. We’re using the OAuth 2.0 client credentials flow with a refresh token rotation every 3600 seconds. Tried invalidating the token cache just in case. No change. The script is doing jack all when the filter is present. It just loops until the timeout.

The payload structure looks standard. The group_by is set to wrapup. The date range covers the last 24 hours.

{
 "date_from": "2023-10-24T00:00:00Z",
 "date_to": "2023-10-25T00:00:00Z",
 "group_by": ["wrapup"],
 "filters": {
 "wrapup": ["a1b2c3d4-e5f6-7890-g123-h45678901234"]
 }
}

Response is just {"data": [], "total_count": 0}.

Wondering if the new retention policy is hiding these records from the analytics endpoint, or if there’s a known bug with custom wrap-up codes in the aggregation layer. The interaction history shows the wrap-up was applied successfully.

  • Wrapup codes require the raw ID instead of the display label, which is why you’re hitting a filter mismatch.
    1. Pull the actual ID from GET /api/v2/users/wrapupcodes using analytics:icd:view. 2. Patch the request body to this:
{
"dateFrom": "2024-05-01T00:00:00.000Z",
"dateTo": "2024-05-02T00:00:00.000Z",
"filters": { "wrapupCodes": ["your_actual_wrapup_id"] }
}

The ICD details endpoint just silently drops results when the array key is off.