Jun 13, 2020 10:49 PM
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 :slightly_smiling_face:
Solved! Go to Solution.
Jun 14, 2020 08:59 AM
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));
Jun 14, 2020 08:59 AM
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));
Jun 14, 2020 10:29 PM
Figured it was something simple and naive. Thank you, sir.