Skip to main content
January 29, 2026
Question

Is there a way to check whether a value is a record type instance?

  • January 29, 2026
  • 5 replies
  • 0 views

Hi,

I am wondering if there is a way to check whether the value stored in a local variable is a record type instance, so that I can use the a!keys() function to retrieve the list of fields and then index through it. Unfortunately, the code below returns a unique UUID for the record instead of something generic like "Record Type" that I could check against using a simple if condition.

typename(
    typeof(
        ABC Comment(
            id: 1,
            comment: "test"
        )
    )
)

Also, if anyone knows an even better solution to check not only for record types but for any type that can be accepted by the a!keys function (e.g. record type, map, dictionary etc), that would be great. Thank you!

5 replies

shubhama926776
January 29, 2026

Could you try this
Make sure localVariable would be single type(Not list.)

if(
  isnull(a!keys(local!yourVariable)),
  "not a valid type",
 "is record/map/CDT/dictionary"
)

January 29, 2026

Hi Shubham, thank you for sharing your idea. The issue I'm facing is that in my case local!yourVariable can be any value, including primitives like Integer or Text, that will basically make a!keys() to return an error.

shubhama926776
January 29, 2026

Try this but not recommended for production.


  try(
    if(
      isnull(a!keys(local!yourVariable)),
      "not a valid type",
      "is record/map/CDT/dictionary"
    ),
    if(
      find("error", fn!lastError().details),
      "not a valid type",
      {}
    )
  )