Skip to main content
anusuyak349977
August 1, 2025
Question

Record Field Id

  • August 1, 2025
  • 10 replies
  • 0 views

Hi everyone [emoticon:c4563cd7d5574777a71c318021cbbcc8],

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)
)

)

    10 replies

    shubhama926776
    August 1, 2025

    No, you cannot use Field IDs to dynamically map data to records.

    /* Method 1: Direct casting (recommended for volume) */
    cast(
      recordType!YourRecord,
      local!mapData
    )
    
    /* Method 2: Using record constructor */
    recordType!YourRecord(
      recordType!YourRecord.fields.name: local!mapData.name,
      recordType!YourRecord.fields.desc: local!mapData.desc
    )
    
    /* For Bulk Operation */
    
    a!forEach(
      items: local!listOfMaps,
      expression: cast(recordType!YourRecord, fv!item)
    )
    


    Field IDs are internal and not accessible for dynamic referencing. Use field references with dot notation instead.

    anusuyak349977
    August 1, 2025

    The Field name in the local and the record are different.
    I dont want to do it manually since it has large set of fields.

    anusuyak349977
    August 1, 2025

    And this local has data of the related records too. So here we cant use direct casting.

    harshas2775
    August 1, 2025

    Can you provide some example of the data structure you have. If your field id in map is analog to record field's field id then index should work. Yet some more details will be better 

    anusuyak349977
    August 5, 2025

    I have a grid with 30 Columns.
    All these column names are stored in Table.

    In the grid, used a!foreach to populate the headers.
    For rows, a!foreach is used for each row generation. And for each column, again a!foreach is used. So here just with index, the values to be saved in the appropriate field.

    In the picture, used an expression rule to return the recordtype!record.field based on the label.

    anusuyak349977
    August 5, 2025

    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.

    mathieud0001
    August 1, 2025

    Have you considered making a dictionary/map mapping the fieldName to the recordField to store the mappings and then using that for the copy? This would allow you to have recordFields using relationships.