Record Field Id

Certified Senior Developer

Hi everyone Slight smile,

I have scenario where my data is stored in Map/Dictionary.

Now this has to be stored in record.
Each field to be mapped with the respective record field.

Considering the volume, Is there a way to use the Field Id to map the value.
Example:

a!localvariables(


local!list:{
{
columnName:"Name",
recordFieldId"4567898765"
},

{
columnName:"Desc",
recordFieldId"4567856894"
},

/* Now the data to be mapped */
a!foreach(
locaL!list,
index(record,fv!item.recordFieldId,null)
)

)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Is there any way, we get the field index from table. Because we already have the Column Labels in table which is queried in the interface. If the field index is stored in table, we can use it easily. Considering the performance of displayvalue() when we have large set of columns, I am checking the possibility of taking it from the table.

  • 0
    Certified Lead Developer
    in reply to Anusuya K Mahalingam

    Let's give it a try by doing this,

    Update an Rule MCI_returnRecordFieldBasedOnLabel

    a!localVariables(
      local!fieldMap: {
        {label: "Name", field: "name"},
        {label: "Description", field: "description"},
        {label: "Status", field: "status"},
        /* Add all 30 field mappings here */
      },
    
      index(
        index(
          local!fieldMap,
          wherecontains(ri!label, local!fieldMap.label),
          {}
        ),
        "field",
        null
      )
    )


    Use this type of grid code:

    a!localVariables(
      local!columns: rule!getColumnsFromTable(), /* Your column labels from DB */
      local!data:{}, /* Your data */
    {
      a!gridLayout(
        rows: a!forEach(
          items: local!data,
          expression: a!gridRowLayout(
            contents: a!forEach(
              items: local!columns,
              expression: a!textField(
                value: index(
                  fv!item,
                  rule!MCI_returnRecordFieldBasedOnLabel(
                    label: fv!item.columnLabel
                  ),
                  null
                ),
                saveInto: {
                  a!save(
                    index(
                      fv!item,
                      rule!MCI_returnRecordFieldBasedOnLabel(
                        label: fv!item.columnLabel
                      ),
                      null
                    ),
                    save!value
                  )
                }
              )
            )
          )
        )
      )
      }
    )