Is there a way to get the list of fields on a record using an expression?

Certified Lead Developer

Is there a way to get the list of fields on a record using an expression? See example below on potential usage.

a!forEach(
  items: 'recordType!{SYSTEM_RECORD_TYPE_USER}User'.fields,
  expression: fv!item
)

If this is not currently supported it would be a great addition that would open up many interesting use cases.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to Stefan Helzle

    Hi Stefan,

    Thanks for the response. Yes, I am familiar with that plugin. I would however like to make use of the latest record features instead if possible, i.e. custom fields and relationships on synced records. Yes, we have a use case that would benefit from accessing the record fields dynamically.

    I don't believe it is currently possible but thought I would put the question out there in any case. I do have a workaround although not ideal, i.e. create an expression rule that returns a list of record type field references explicitly. For example.

    {
      'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{firstName}firstName',
      'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{lastName}lastName'
    }

    Kind Regards,

    Philip Snyman

  • 0
    Certified Lead Developer
    in reply to Philip Snyman

    OK. Got it. Why not just cast the record type to its CDT type?

    There is a ugly hack from the old days using toxml and xpath to extract the field names. Did not test this with a record type.

  • Philip can you provide more context on how you plan to use these dynamically created fields? We're actively looking at ways to improve using / referencing record fields, but understanding how you plan to use them can help us prioritize accordingly. Thanks!