What are the best practices in Appian?
Discussion posts and replies are publicly visible
Just a quick question regarding the best practice that we follow:
Do we have to use constants for helptooltip messages and validation messages or we can directly write it in the UI?
I mean is this a part of best practice to be followed in appian or it depends ?
For me this is 100% in the realm of "it depends". It's one of those things that depends on the preferences of your project leadership. It also depends on issues like "what does this effect?". Does your tooltip message appear multiple places in an application, requiring consistent language everwhere? Or is it a one-off? Same thing with validation messages. If you have one string that will be used in many places consistently, placing it in a constant would allow easily updating everywhere that language appears, versus having to go around to many different interfaces/etc making manual updates.
I've been on projects before where our project best practices dictated that no hardcoded literal values were to be used anywhere. If you wanted a label or anything along those lines it had to be sourced from a constant. We had to use a constant instead of "true()" or "false()" (the constant's value was just the boolean value though). If we needed to set something to a value of "1" (as in the integer, not the character), we had to use "cons!GLBL_INT_VALUE_1" instead of just using the character on-form. At some point there's not much to gain from using constants for everything, and it risks cluttering up your environment with things that are minimally useful and/or won't be widely used, and gets a little confusing.
The one place i try to *always* use a constant is for the "value" parameter of a Submit Button, where that value will get passed out into the process instance and referenced i.e. in a decision gateway. The reason for this is that typos causing a mismatch between the button value and the value being checked in the gateway are fairly easy when hardcoding, and a lot easier to avoid / track / check when using a constant.
© 2021 Appian. All rights reserved.