- 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-30-2025 03:21 PM
Hi @Robert H,
Unfortunately, no. I was simply using the incident state field to illustrate my problem.
My actual use case is with the 'cmdb_rel_ci' table. I had a need to search for CI relationships using GlideQuery, based on a field available only on an extended CMDB table, not on the base 'cmdb_ci' table.
Because of the apparent lack of extended table searching in GlideQuery, I needed to introduce an intermediate step to search that extended table explicitly first, then pass the resulting Sys IDs to the 'cmdb_rel_ci' search. It got the job done, but extended table searching would have been more efficient.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 03:26 PM
Hi @Robert H,
Unfortunately, no. I was simply using the incident state field to illustrate my problem.
My actual use case is with the 'cmdb_rel_ci' table. I had a need to search for CI relationships using GlideQuery, based on a field available only on an extended CMDB table, not on the base 'cmdb_ci' table.
Because of the apparent lack of extended table searching in GlideQuery, I needed to introduce an intermediate step to search that extended table explicitly first, then pass the resulting Sys IDs to the 'cmdb_rel_ci' search. It got the job done, but extended table searching would have been more efficient.