- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 07:59 AM
Is there anyway I can do an addQuery on the display value of a reference field?
u_iccb_fisma_id is a reference field to the cmdb_ci_service table. I know the u_iccb_fisma_id is actually the sys_id.
Or do I have to do a GlideRecord on the cmdb_ci_service table first to get the sys_id first and THEN do a GlideRecord on the u_iccb_fisma_information table to add to the query. (there's going to be multiple u_iccb_fisma_id's that I will be querying on, so it will eventually be addQuery('u_iccb_fisma_id', 'IN', 'ABC, XYZ....');
var gr = new GlideRecord('u_iccb_fisma_information');
gr.addQuery('u_iccb_change_request_number', 'b528a518dbbbc3003a8034cc7c9619d7');
gr.addQuery('u_iccb_fisma_id', 'ABC');
gr.query();
if(gr.next()){
test = true;
}
Thanks!
Lisa
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 08:14 AM
Hello Lisa,
You can do it via dot-walking i.e Replace gr.addQuery('u_iccb_fisma_id', 'ABC'); with gr.addQuery('u_iccb_fisma_id.name', 'ABC'); //Here name refers to field in cmdb_ci_service table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 08:14 AM
Hello Lisa,
You can do it via dot-walking i.e Replace gr.addQuery('u_iccb_fisma_id', 'ABC'); with gr.addQuery('u_iccb_fisma_id.name', 'ABC'); //Here name refers to field in cmdb_ci_service table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 08:15 AM
#Pradeeped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 10:49 AM
Now why didn't I think of that!!??!! Thanks everyone for the answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 08:15 AM
Dot walk up to the display field for the table that field references: Don't know what that might be for your custom table, so I'll illustrate with Incident:
var rotisserie_chicken = new GlideRecord('incident');
rotisserie_chicken.addQuery('caller_id.user_name','Prostetnic Vogon Jeltz');
rotisserie_chicken.query();