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
  • 0
    Certified Lead Developer

    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.

Reply
  • 0
    Certified Lead Developer

    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.

Children