Is there a way to get the full object of a reference field in a glide query?

nicksoltis
Kilo Expert

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

5 REPLIES 5

puneetgoels1
Tera Guru

Use .getRefRecord() to get the gliderecord for the reference field