Hi,
I'm trying a simple code using an Interface containing a RecordType based grid, and I need to pass the 'fv!row' to an ER to make some fields calculations/traitements for the current row.
In this example (below), all works fine because I've used the workaround to add the column "year" in the grid (showWhen = false, because I do not want to display this column in my example).
If I remove this column from the Grid, it seems that the "year" field is reset to null in 'fv!row', so the ER can not work with this field anymore as it is always set to null.
Could you tell me why there is such an issue ? passing RecordType 'fv!row' automatically casted into CDT seems to work yet.
How would you do to make it working (removing definitively the "year" column) ?
*** Interface : a!formLayout( label: "Grid with RecordType", contents: { a!gridField( label: "Vehicles", labelPosition: "COLLAPSED", data: a!recordData( recordType:'recordType!CJT_R_Vehicles', filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!CJT_R_Vehicles.fields.deleted', operator: "=", value: false ), }, ignoreFiltersWithEmptyValues: true ) ), columns: { a!gridColumn( label: "Id", sortField: 'recordType!CJT_R_Vehicles.fields.id', value: fv!row['recordType!CJT_R_Vehicles.fields.id'], align: "END" ), a!gridColumn( label: "Model", sortField: 'recordType!CJT_R_Vehicles.fields.model', value: fv!row['recordType!CJT_R_Vehicles.fields.model'] ), /* If this column is removed the code does not work: the "year" field is not concatened in the Calculation field below */ a!gridColumn( label: "Year", sortField: 'recordType!CJT_R_Vehicles.fields.year', value: fv!row['recordType!CJT_R_Vehicles.fields.year'], showWhen: false ), /* Grid to display some traitments/calculations fields */ a!gridColumn( label: "Calculation", value: rule!CJT2_CalculateFromCurrentRow( vehicle: fv!row, ) ), }, ), }, ) *** ER CJT2_CalculateFromCurrentRow : RI : ri!vehicle (type: CJT_Vehicle) if(a!isNotNullOrEmpty(ri!vehicle), ri!vehicle.id & "-" & ri!vehicle.year, "empty" )
Discussion posts and replies are publicly visible
Seems like a!recordData only fetches the fields directly used in the grid. Then you solution with hiding the column would be the only option.
Otherwise, you could also use a!queryRecordType to fetch the data.
I have another question :
When I was using a!recordData, my Related Action added in CJT_R_Vehicles was available and working (the corresponding process was well started).
Now I'm using a!queryRecordType as suggested, the Related Action does not work anymore, I obtain the error below.
I'm surprised, I did not change anything else.. Any idea ?
" The specified CJT_R_Vehicles related action does not exist or you do not have permission to view it "
You can only use record actions if your data source is explicitly a record type. I actually would recommend just adding the hidden column and including the field in there. Is there any reason that doesn't work?
Thank you Peter. Yes, I finally kept the a!recordData, and added the hidden column, and all works fine.
I was trying to use a!queryRecordType because I thought it were returning an explicit RecordType too. But now I understand it is not the case.