Related Record Data not visible

Certified Senior Developer

I have a record type called : Global Case 

the fields for this record type are :

caseId : Number (Integer) ,
caseTypeId : Number (Integer) 

Now this record is related to another recordType called : Global Case Type 

the fields for this record type are : 

caseTypeId : Number (Integer),
caseTypeName : Text

My database looks something like this : 

Global Case : 

CaseId CaseTypeId
1 1

Global CaseType

CaseTypeId CaseTypeName
1 Dummy Case Type

Requirement :

I want to display on an UI the case and its caseType in a grid 

Approach : 

I did a query record type and queried all the cases and then used the relationship to display value. (Code : )

 

a!localVariables(
  local!case: a!queryRecordType(
    recordType: recordType!GCMF Case,
    filters: a!queryFilter(
      field: recordType!Global Case.fields.caseId,
      operator: "=",
      value: 1
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 1
    )
  ).data,
  a!gridField(
    data: local!case,
    columns: {
      a!gridColumn(
        label: "Case Id",
        value: fv!row[recordType!Global Case.fields.caseId]
      ),
      a!gridColumn(
        label: "Case Type",
        value: fv!row[recordType!Global Case.relationships.globalCaseType.fields.name]
      )
    }
  )
)

Now the problem here is, even though I use the relationship field, the data displayed is null, i.e. it is not displaying the caseType name 

Now I am aware that I can simply use the recordData function and get the data in the gridField (but my business requirements are to use only queryRecordType function)

also aware that I can add the caseTypeName in the fields section of queryRecordType function  (in actuality there are more then 10 relations and each relations has many fields : so does not actually makes sense to add those fields in the query record type ) 

can anyone help ? 

  Discussion posts and replies are publicly visible

Parents Reply Children