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

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:

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:

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 :slight_smile:

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));
1 Like

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

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