Skip to main content
Solved

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 🙂

Best answer by Kasra

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

View original
Did this topic help you find an answer to your question?

2 replies

  • Inspiring
  • 192 replies
  • Answer
  • June 14, 2020

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


Kasra wrote:

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.


Reply