How do you get the column name for the display value of a reference field on its source table?

Jason70
Giga Contributor

How do you get the field name value from the table that a reference field in a record is referring to? For example in an incident record, the "assigned to" field displays the name "Joe Shmoe", this is a reference field to the "sys_user" table, where the value "Joe Shmoe" is stored on a specific record in a specific column. I need to be able to get the column name in which that name that was being displayed in the reference field is being stored. This is being done via a script step at the moment. I am thinking there is going to be some built in function such as ".getReference()" that provides this type of information. ".getReference()" is providing me the name of the source table for the reference value at the moment but I need to get the column name for that display value still.

6 REPLIES 6

Yousaf
Giga Sage

Hi Jason,

You can use these 

getDisplayValue('field name')  //Server side
g_form.getDisplayBox('field_name'); //Client Side

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Jason70
Giga Contributor

Yousaf,

This would only provide the display value of the field on the incident table. I need the column name of the display value on the table it is referencing. Thank you

Hi Jason,

I misunderstood maybe you can leverage getReferenceTable() somehow for that.


***Mark Correct or Helpful if it helps.***

Claude DAmico
Kilo Sage

You can try these:

gr.referenceField.getRefRecord().getDisplayName();  //Server side field name of referenced record
g_form.getDisplayBox('referenceField').attributes[1].name; //Client side field name of referenced record

 

Claude E. D'Amico, III - CSA