Skip to main content
guillermom
August 9, 2023
Solved

Not getting related data from record type relationship

  • August 9, 2023
  • 4 replies
  • 0 views

I have 2 record types, totally Sync, with a relationship One Event to Many Instructions, properly related, as I have a custom record field in Event about a sumatory of an Instructions field which is correctly working...

But then, when I query the Events,I retrieve nothing using: 

local!instructions: local!events[recordType!Event.relationships.instruction]
.

So I've tried to fill the relatedRecordData field in the query of events but it keeps retrieving nothing, null data. 

local!events: a!queryRecordType(...
relatedRecordData:
a!relatedRecordData(
    relationship: recordType!Event.relationships.instruction
    ),
...    ),
local!instructions: local!events[recordType!Event.relationships.instruction.idInstruction],




How can this be? Maybe Security, how? Is it just not the proper way to retrieve its data?

Thanks in advance

Best answer by mathurambm639546

You can use the 'fields' parameter to get the related record fields when querying the records.

local!event:a!queryRecordType(
  recordType: cons!REC_TYPE,
  fields:{
    recordType!Event.relationships.instruction
  },
  filters:{},
  pagingInfo: a!pagingInfo(1,10)
)

4 replies

August 9, 2023

You can use the 'fields' parameter to get the related record fields when querying the records.

local!event:a!queryRecordType(
  recordType: cons!REC_TYPE,
  fields:{
    recordType!Event.relationships.instruction
  },
  filters:{},
  pagingInfo: a!pagingInfo(1,10)
)

guillermom
August 9, 2023

Hi Mathurambika,

Thanks for your answer, it works. But it forces me to write every single field in my RT, is it the only solution for my problem?

August 9, 2023

AFAIK, we have to pass all the related record fields in the 'fields' parameter in order to access their data.