How to pass a RecordType row from an Interface to an ER (keeping all the fields)

Certified Senior Developer

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

Parents Reply
  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    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 "

Children