Forum Discussion

Chandan's avatar
Chandan
New Contributor III
2 years ago
Solved

ServiceNow Query Snap - Pass through does not work for empty result

I’m trying to use the servicenow query snap to query a table.
For my use case, i may get few missing properties in a input request. I have to query servicenow and fetch these missing properties from a table if found, else just use the original request with missing properties.
I have configured the servicenow query snap by enabling “Pass Through” & “Allow Empty Query Result”.
This works fine if the record is found in servicenow table. But when the record is not found in servicenow table, the snap just returns empty object which does not have original request.
As “Pass Through” is enabled , regardless of record found or not, snap should give the original object at output but that is not happening.
Am i missing something here or is it a BUG for this snap ?
Any help will be greatly appreciated.

Output when the record is found : Note that it has the original key containing the original input request to servicenow query snap.

Output when the record is not found : It is missing the original key containing the original input request.

there are other alternatives too but I’m using servicenow query snap as it makes it easier to fetch the values for the reference fields which makes it perfect for my usecase.

  • Hello Chandan,

    ServiceNow Query snap with enabled Allow Empty Query Result and in that case, if provided sys_id exists or record matched, showing the original document.

    ServiceNow Query snap with enabled Allow Empty Query Result and in that case, if provided sys_id does not exists or record is not matched, showing the original document.

6 Replies

  • del's avatar
    del
    Contributor III

    You might could consider disabling the Allow Empty Query Result option and enabling an error view which would capture the pass-through data in the event that no results are returned. Then follow up with a Union snap and mapping as needed.

    Something like this:

    • sreddi's avatar
      sreddi
      Employee

      Hello Chandan,

      ServiceNow Query snap with enabled Allow Empty Query Result and in that case, if provided sys_id exists or record matched, showing the original document.

      ServiceNow Query snap with enabled Allow Empty Query Result and in that case, if provided sys_id does not exists or record is not matched, showing the original document.

      • Chandan's avatar
        Chandan
        New Contributor III

        Thank you sreddi for a detailed solution. This worked for me but i still have suggestion if ServiceNow query snap can return intialReq if pass through is enabled and no matching record is found.  Can it be raised as an enhancement ?

    • Chandan's avatar
      Chandan
      New Contributor III

      Thank you del. This was a great workaround for my usecase.