TABLE sys_dictionary: sysparm_query not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 07:58 AM - edited 08-18-2023 08:02 AM
Greetings
I aim to dot walk internal_type.value with a specific type and return sysparam_fields table name and element.
URL decoded:
/api/now/table/sys_dictionary?
sysparm_query=internal_type.value=boolean
&sysparm_fields=name,element,internal_type
&sysparm_limit=10
Result does not return expected from query:
{
"name": "sys_hub_pill_compound",
"internal_type": {
"link": "https://dev105877.service-now.com/api/now/table/sys_glide_object?name=string",
"value": "string"
},
"element": "attached_to"
},
{
"name": "sys_hub_sub_flow_instance",
"internal_type": {
"link": "https://dev105877.service-now.com/api/now/table/sys_glide_object?name=collection",
"value": "collection"
},
"element": ""
},
URL encoded:
/api/now/table/sys_dictionary?sysparm_query=internal_type.value%3Dboolean&sysparm_fields=name%2Celement%2Cinternal_type&sysparm_limit=10
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 12:02 PM
The reason why the query is not returning the expected results is because the internal_type field is not a JSON object. It is a JSON link object.
The link property of the internal_type object contains the URL of the JSON object that represents the actual internal type.
To dot walk the internal_type object, I guess you need to use the . operator to access the value property.
Please try below query -
/api/now/table/sys_dictionary? sysparm_query=internal_type.value.type=boolean &sysparm_fields=name,element,internal_type &sysparm_limit=10
The results of this query will be the same as the results of the first query, but the internal_type object will be represented as a JSON object instead of a JSON link object.
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 03:17 PM
@Tushar Check this out this afternoon.