Help

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

Solved
Jump to Solution
540 0
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
Kasra
9 - Sun
9 - Sun

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
Kasra
9 - Sun
9 - Sun

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.