Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

How do I query Linked Records from a Linked Record Field in a nested component?

Topic Labels: Custom extensions
Solved
Jump to Solution
790 2
cancel
Showing results for 
Search instead for 
Did you mean: 

I’m trying to query Linked Records out of a Linked Record Field from the record selected by cursor. I am trying to do so inside a component that is nested 4 levels deep, and has had said record passed down to it through props.

When I attempt to await the result of .selectLinkedRecordsFromCellAsync() I get an error:

CleanShot 2020-06-13 at 22.37.04@2x

And when I attempt to get them directly from .selectLinkedRecordsFromCell(), I get nothing back in my const linkedRecords, even though I’m 100% certain I have Linked Records there to query:

CleanShot 2020-06-13 at 22.37.56@2x

I’m doing a horrible job of debugging this, and I have a feeling it’s likely something simple – a rookie mistake that I’m just missing. So I figured it’s probably about time to just ask and learn. Thanks for any help you can offer :slightly_smiling_face:

1 Solution

Accepted Solutions

selectLinkedRecordsFromCell returns a LinkedRecordsQueryResult. QueryResults need to be loaded before the records inside them are accessible. Since you’re inside a React component, you can use the useRecords hook to load the records.

So something like:

const linkedRecords = useRecords(record.selectLinkedRecordsFromCell(linkedRecordField.id));

See Solution in Thread

2 Replies 2

selectLinkedRecordsFromCell returns a LinkedRecordsQueryResult. QueryResults need to be loaded before the records inside them are accessible. Since you’re inside a React component, you can use the useRecords hook to load the records.

So something like:

const linkedRecords = useRecords(record.selectLinkedRecordsFromCell(linkedRecordField.id));

Figured it was something simple and naive. Thank you, sir.