Referencing a "Link To Another Record" Field

Hello!

I’m trying to edit a script that I already have. To do so, I need to be able to get values from a Link to Another Record. The linked record is on a different table. I’ve been using .getCellValue() for most cases, but it doesn’t seem to be helping me here. Right now, when I run the .getCellValue, it returns an Object, and when I run .getCellValue().values, it outputs “function”.

How can I get a specific field off of the linked record?

Here are two approaches…

  1. You could use a lookup field to pull over the value from the other table - this way it’s already part of the selected record when your script runs.

  2. If you don’t want to do that, you’ll need to select the record on the other table in order to use the getCellValue() method.

If the linked record field you’re referencing only has one value in it (I.e is only linked to one record on the other table), the following code should work for you:

let recordToSelect = selectedRecord.getCellValue("Linked Record Field Name")[0];


let recordFromOtherTable = await otherTable.selectRecordAsync(recordToSelect.id);

let valueFromOtherTable = recordFromOtherTable.getCellValue("Field From Other Table");

The above is drastically simplified but if you want to share more info I’m happy to help you adjust for your code / use case :slight_smile:

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.