Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Are there limits on dot walking in sysparm_query in the Table API? Qualifying a dot walked sysparm_field returns not data.

Jerry Flood
Mega Contributor

Using Table API I can return dot walked fields many levels deep, pseudo code example.

sysparm_fields=ref1.name,ref1.ref2.name

sysparm_query=ref1.name=REF1NAME

returns

{
"ref1.ref2.name": "REF2NAME",
"ref1.name": "REF1NAME",
},

but seems I can only qualify one level deep. The following returns nothing

sysparm_query=ref1.ref2.name=REF2NAME

Am I missing something ?

Thanks

Jerry

6 REPLIES 6

SanjivMeher
Mega Patron
Mega Patron

Did you try copying the value from a query builder and use it in the table api?


Please mark this response as correct or helpful if it assisted you with your question.

Thanks Sanjiv,

I did not. I am following the documentation and used the same syntax for sysparm_fields which works fine, but when using the same notation in sysparm_query beyond 1 level, I get empty results.

I couldn't find any working examples, so was curious if there was a limitation in the API.

 

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Jerry,

I just tested with sysparm_query containing a dot walk 2 levels deep.

manager.manager.user_name=abraham.lincoln

find_real_file.png

Was able to get an answer.

find_real_file.png

 I've tested the reply by comparing it with the result from running the following background script. Recommend running the query as a background script to see if the query will return a value expected.

var gr = new GlideRecord('sys_user');
gr.addQuery('manager.manager.user_name','abraham.lincoln');
gr.query();
while (gr.next()) {
  gs.info(gr.user_name);
}

Thanks Hitoshi,

This is the kind of working example I was looking for. I reproduced your example in our instance and confirmed that my syntax is correct.

The issue must be related to the specific tables I am attempting to query. I can see the field in the unqualified results, but when I cut and paste the actual values into the sysparm_query, it returns an empty result.  

I will give the background script a chance (new feature to learn 😉 It may provide a clue.