- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 04:25 PM
With GlideRecord, there's a notation that you can use to query a field of an extended table - ref_(extended_table_name).
For example:
var taskGr = new GlideRecord('task');
taskGr.addQuery('ref_incident.incident_state', '1');
taskGr.query();
Is there an equivalent notation when using GlideQuery?
If I try to use similar notation as the GlideRecord example above with GlideQuery, an error is thrown.
var taskGq = new GlideQuery('task')
.where('ref_incident.incident_state', '1')
.selectOne('number')
.get();
// ERROR THROWN: Cannot dotwalk field 'ref_incident' on table 'task': not a reference field
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 11:24 PM
Hello @XavierCalder ,
Understood. Unfortunately GlideQuery still has some limitations, including missing support for encoded queries, which I believe includes the "'ref_{table}.{field}" syntax.
But instead of doing those extra steps that you mentioned I would just go back to using good old GlideRecord for this particular requirement.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 10:36 AM
I have the same issue. Have you found a solution to selecting / querying an extended table field with GlideQuery ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 12:40 PM - edited 03-28-2025 12:41 PM
Hello @XavierCalder ,
I do not think GlideQuery supports this.
But in your particular example you could use:
...
.where('sys_class_name', 'incident')
.where('state', 1)
...
because "state" is available on the task table and should always have the same value as "incident_state" (unless something was customized). I know it's not a general answer to your question but maybe it helps.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 03:12 PM
Hi Robert,
Unfortunately, no. I was just using the incident state field as an example for my actual use case.
In my case, I'm dealing with the 'cmdb_rel_ci' table, where I need to match CI relationships based on fields not available on the base 'cmdb_ci' table.
Because of the apparent lack of extended table field searching in GlideQuery, I needed to introduce extra steps to search that extended CMDB table explicitly first, then use the resulting Sys IDs to search the 'cmdb_rel_ci' table.
I would prefer to cut out those middle-man steps if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 11:24 PM
Hello @XavierCalder ,
Understood. Unfortunately GlideQuery still has some limitations, including missing support for encoded queries, which I believe includes the "'ref_{table}.{field}" syntax.
But instead of doing those extra steps that you mentioned I would just go back to using good old GlideRecord for this particular requirement.
Regards,
Robert