Is there a way to get the full object of a reference field in a glide query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 12:38 PM
I am looking to query on a bridge (relationship) table to pull and store the reference fields as objects. This is hard to explain, so I will give you my example.
EX:
TABLES INVOLVED: vtb_board, vtb_card, vtb_task, vtb_lane
Visual Task Board Card (vtb_card) has 3 reference fields that I would like to access (aka the "bridge" table)...
1. "task" -> reference to Personal Task (vtb_task)
2. "lane" -> reference to Visual Task Board Lane (vtb_lane)
3. "board" -> reference to Visual Task Board (vtb_board)
SCRIPT
data.taskData = [];
var gr = new GlideRecord("vtb_card");
gr.addActiveQuery();
gr.query();
while(gr.next()){
var temp = {};
temp.task = gr.task.getFullReferenceObject();
temp.lane = gr.lane.getFullReferenceObject();
temp.board = gr.board.getFullReferenceObject();
data.taskData.push(temp);
}
I know that I can populate them by adding to the array of objects using multiple glide query's, but I figured that something like this would exist already in the SN universe.
Thanks,
Nick

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 01:10 PM
Use .getRefRecord() to get the gliderecord for the reference field