Skip to main content
March 10, 2026
Solved

Preferred way to create a Constant based on a Record Type

  • March 10, 2026
  • 5 replies
  • 0 views

Hi Guys, what is the prefered way to create and use constants in an appian application.

I have created the following record types "Order", "Order Lines", "Order Type" and "Order Status".

The "Order" Record Type has an orderTypeId (Number - integer) and orderStatusId (Number - integer) fields and relationships added to these tables. 

I have now created two constants called "CONS_ORDER_TYPE" and "CONS_ORDER_STATUS" which binds directly to the above mentioned Record Types.

How would you use these two constants in eg. a dropdown list? 

I mean, if you create a constant of type array and add text values {"Created","On Hold", "Fulfilled"} what is the purpose to create the "Record Type" entities for the constants (Order Type and Order Status) since you can just use the data type "text" for the orderStatusId and orderTypeId fields on the "Order" record type.

    Best answer by samikhelb655834

    Using "Record Types" for things like Order Status or Order Type is generally the better approach, especially as the application grows.

    If you only use a constant with a text array such as {"Created","On Hold","Fulfilled"}, it may work for small cases, but it becomes harder to manage when you need to add new statuses, change labels, support translations, or maintain relationships in the database.

    With "Record Types", you keep a proper reference table where each status or type has an **ID and a label**. The dropdown can then use the record data source, for example using the status name as `choiceLabels` and the status ID as `choiceValues`. This keeps the database normalized and allows you to safely store only the IDs in the Order record.

    Another advantage is maintainability. If a new status is added later, you just insert a new record instead of updating constants or redeploying rules.

    So in practice, the constants that reference the **Order Type** and **Order Status** record types are useful as centralized references, and the dropdown can simply query those record types to populate the options dynamically.

    5 replies

    pabloe322909
    Participating Frequently
    March 10, 2026

    You put that constant containing a string array in the choiceLabels of the dropdown, and then what would you put in the choiceValues? You would need another array with the respective identifiers and then save those relationship, no? Isn't easier managing all that with a record type? And yes, you could declare orderStatusId and orderTypeId as text and write down the strings directly there, but when you have a few milion rows and you try to execute any massive database operation you'll regret, even if the columns are indexed depending on some cases.

    samikhelb655834
    March 10, 2026

    Using "Record Types" for things like Order Status or Order Type is generally the better approach, especially as the application grows.

    If you only use a constant with a text array such as {"Created","On Hold","Fulfilled"}, it may work for small cases, but it becomes harder to manage when you need to add new statuses, change labels, support translations, or maintain relationships in the database.

    With "Record Types", you keep a proper reference table where each status or type has an **ID and a label**. The dropdown can then use the record data source, for example using the status name as `choiceLabels` and the status ID as `choiceValues`. This keeps the database normalized and allows you to safely store only the IDs in the Order record.

    Another advantage is maintainability. If a new status is added later, you just insert a new record instead of updating constants or redeploying rules.

    So in practice, the constants that reference the **Order Type** and **Order Status** record types are useful as centralized references, and the dropdown can simply query those record types to populate the options dynamically.

    pabloe322909
    Participating Frequently
    March 10, 2026

    **exactly**

    shubhama926776
    March 11, 2026

    Use Record Types with integer FK as the preferred approach, since it enables proper relationships, filtering, and reporting.
    Your orderStatusId stores the integer Id, and the dropdown fetches labels from the Order Status record type via a!queryRecordType().
    Drop the text array constants - they're a shortcut that breaks relational integrity and doesn't scale.