- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2017 05:08 PM
I am unable to filter the metric instance using the table REST API on a dot-walked field.
Example (filtering metric_instance fields to a specific incident number)
https://[instance].service-now.com/api/now/table/metric_instance?sysparm_query=id.number%3DMINC0014487&sysparm_fields=id%2Ctable%2C%20id.number
It returns the dot-walked field as expected, but does not filter it at all. I checked incident and dot-walked filters work for created_on, perhaps there is something special because the id field in metric instance can point to different tables?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 12:30 AM
Hello Mark,
The id field on metric instance is a Document Id field and not a Reference field. You cannot dot walk a document id field directly but you can access its value which obviously is the sys_id of the record and then use a Glide query to access its fields.
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 12:30 AM
Hello Mark,
The id field on metric instance is a Document Id field and not a Reference field. You cannot dot walk a document id field directly but you can access its value which obviously is the sys_id of the record and then use a Glide query to access its fields.
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 04:02 AM
Thanks. I'm using the REST API and accessing the other fields. But it does mean that I have to consume much more rows from the server without this ability.
Is there a way to make a view and query it through the API to filter based on a field in a document reference (in my case it is OK to limit to a particular table)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 04:09 AM
Yes you can try using database views to join metric_instance and incident table. Rest API supports querying on views (get).
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response