Enumeration vs Entity

2
I frequently ask myself whether I should use an Enumeration value or a new Entity for certain use cases. (Status drop downs are probably the most common).  There are benefits to both, but I have second guess my decision on multiple occasions.  I like the Entity because I can manage on the front-end without having to redeploy the app, and some of my logic can be more dynamic by retrieving lists.  However, when using xpath constraints I find myself using free text, which makes me nervous for long term stability.  Enumerations are great because they are integrated into the Modeler rule checking so I can't make a typo, however, the limitations on Enumerations make them a tedious option in most cases. Any good articles or feedback on this dilemma?
asked
2 answers
4

I've been faced with these situations on my current project. I found myself going more the entity route because of how dynamic our customer wants their system to be. 

When deciding between the two I usually ask a few questions to determine if it should be an enumeration vs an entity.  I usually ask how often do these options change, and does this selection drive any logic in the application.

If the options don't change that much, then it could be a candidate for an enumeration, but if they need to be changed pretty often or if a change needed to be done immediately then an entity would be better suited.  

If the selection drives any logic in a microflow or is used for conditional visibility, then it would be a lot easier to use an enumeration but you could still use an entity and add flags that would be configured during the initial setup. This helps avoid having to use Xpath retrieves with fix text. 

 

That's just a few factors that I could think of off the top of my head. Hope this helps!

answered
1

I tend to go with entities all the time.

Even when everyone says 'it will never change' it probably will.

If it's about logic, you can add that to the entity, which makes it a lot clearer. So for instance when you have a conditional split on your enumeration, and you start using an entity instead, then add an attribute to the entity that takes that decision. That way, the logic can be changed in the admin screen.

answered