filter metric instance using dot-walking

markledwich
Giga Contributor

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?                                      

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

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.



Create a document ID field



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

3 REPLIES 3

Alikutty A
Tera Sage

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.



Create a document ID field



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


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)?


Yes you can try using database views to join metric_instance and incident table. Rest API supports querying on views (get).



Database views



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response