IDN - Servicenow query

Hi,

I’m running into an issue where my ServiceNow GET request always returns - “X-Total-Count”: [“0”] even though the user already has an active ticket in the system.

In my workflow, I check the header value like this:

Value 1: $.hTTPRequest.headers['X-Total-Count'][0]
Operator: Equals
Value 2: 0

Because the header keeps coming back as "0", the flow assumes no tickets exist and creates a new one—resulting in duplicate tickets for users who already have one. Please assist.

Hello Selvarani,
I think there are two areas worth checking here.

First, if X-Total-Count is coming back as "0" even though a ticket already exists, I would start by validating the ServiceNow sysparm_query. Sometimes the workflow logic looks fine, but the query is not matching the expected record. If you are filtering directly on reference fields like caller_id or requested_for, try using the ServiceNow user’s sys_id, since reference fields store the sys_id as the actual database value (see ServiceNow Table API). If you only have the email or display name, you can dot-walk the query instead, for example caller_id.email=<email>, depending on your table and field setup. The quickest way to confirm any of this is to run the same GET request directly in your instance’s REST API Explorer using the same integration user.

Second, this path looks okay: $.hTTPRequest.headers['X-Total-Count'][0]

But the header value is always returned as a string. So if you are using Compare Numbers, I would try Compare Strings and compare it against "0" as a string value.

Validate the ServiceNow query first, then confirm the string comparison in the workflow. That should help narrow down why duplicate tickets are still getting created.

Thank you for the input, that helps!