Get Record Type meta data (data type, length and decimals)

Certified Senior Developer

Hi all!

For my application, I need to acquire the data type and length (and the number of decimals in case of a float) of all the fields from a single Record Type (and preferably the source fields as well). Now, as far as my knowledge goes there is no out-of-the-box solution for doing this. For acquiring the data types of a Record Type I have made the following solution: 

/*Partly based on the solution provided in https://community.appian.com/discussions/f/general/23723/map-with-variable-key */
if(
  rule!isVoid(ri!record), /*use your void check expression here */
  {},
  a!localVariables(
    local!xml: toxml(ri!record),
    local!json: a!fromJson(a!toJson(ri!record)),
    local!keys: a!keys(local!json),
    local!types: extract(
      local!xml,
      cons!XML_FIND_TYPE_START_DELIMITER,
      cons!XML_FIND_TYPE_END_DELIMITER
    ),
    cast(
      typeof(a!map()),
      reduce(
        a!update,
        local!json,
        merge(local!keys, local!types)
      )
    )
  )
)

XML_FIND_TYPE_START_DELIMITER contains (text): xsi:type="xsd:

XML_FIND_TYPE_END_DELIMITER contains (text): " uuid="

In this expression, if you put in a random record of your preferred Record Rype (fields can be filled of null), it will output a Map with the field names as string and XML types as string. 

Now since this is not perfect (to and from json have an impact on the performance) and does not work for acquiring the max length and number of decimals, I was wondering if people have found other out-of-the-box ways for retrieving Record Type field metadata? And if not, maybe Appian can implement features to retrieve this kind of information?

Thank you very much for reading,

Kind regards.

  Discussion posts and replies are publicly visible