How do you get the column name for the display value of a reference field on its source table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 12:54 PM
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.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 05:48 AM
The "getDisplayName()" function only provides the name of a user, I need the name of the column on the referenced table that is being displayed. The example of this being a user was to illustrate the problem, however, the fields this would be used on include more than just a user field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 02:32 PM
getDisplayColumn(String tableName) - Retrieves the display column for the table.
Assuming you know the table the reference field looks to, this function should do the trick.