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
caseTypeId : Number (Integer), caseTypeName : Text
My database looks something like this :
Global Case :
Global CaseType
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
Hi GautamShenoy ,
try this.
a!localVariables( local!case: a!queryRecordType( recordType: recordType!GCMF Case, fields: recordType!Global Case.relationships.globalCaseType.fields.name, 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] ) } ) )
I am trying to lookout for options other then adding the relationship fields in the queryRecordType function Sri Ram Kaja
but without getting the value of that particular field, if you try using related field, then it will show null
that is the thing na ... I am looking out for alternatives ... we do not specify any field, yet it gets all the record values right ...was looking out for something similar
coz in my actual application, I have like 10 relations and each of them have like 7 / 8 fields ... so mentioning around 80 of them makes no sense to me
AFAIK, there is no need to specify all fields. You can specify just the relationship and all fields will be available.
fields: recordType!Global Case.relationships.globalCaseType
ohhhh yesss ... It completely skipped my mind
Thanks