How to effectively prevent UI evaluation errors when choiceValues change?
In my project, we are commonly using a table holding reference data to be displayed in dropdown fields.
The problem is, whenever these values change, the dropdowns get updated, but if a value has been removed or edited, but previously saved to the database, now we get a UI evaluation error saying that the value is not present in the choiceValues - which is understandable, of course.
But how can we effectively guard against this sort of behavior? After an update like this, we usually face a billion errors when users (or developers) bring up an old record or old task, which had a value saved that is no longer present in a dropdown. Is there a good preventive measure for this sort of cases?
Discussion posts and replies are publicly visible
Witold Wozniak said:"Now a way to fix it with the text data is to check if the data is present in the choiceValues and if yes, then only show it in the value else show null." I guess this would be a way to prevent the evaluation error, but I think it would be up for debate to decide whether a blank dropdown is even worse than evaluation errors, since they are easier to miss, and errors usually force quick fixes. Am I reasoning correcly?
"Now a way to fix it with the text data is to check if the data is present in the choiceValues and if yes, then only show it in the value else show null."
I guess this would be a way to prevent the evaluation error, but I think it would be up for debate to decide whether a blank dropdown is even worse than evaluation errors, since they are easier to miss, and errors usually force quick fixes. Am I reasoning correcly?
I'm with Harshit, I almost always configure my dropdowns to check if a value is present in the options, if not, show null. I can't think of any case where it would be better to have an evaluation error rather than a blank dropdown selection - with a required flag, the user will be forced to choose a new value during submit/resubmit.
a!localVariables( local!options: { "A", "B", "C" }, local!selection: "D", a!dropdownField( label: "Options", placeholder: "--Select--", choiceLabels: local!options, choiceValues: local!options, value: if( contains(local!options, local!selection), local!selection, null ), saveInto: local!selection, required: true ) )
Somewhat agree all pink = bad.
However, I would avoid a band-aid that prevents the underlying problem from getting solved.
However, blank spaces on a dropdown are such glaringly obvious bugs I could scarcely imagine a scenario where fixing it wouldn't be top priority for business, so band-aid would never keep it from getting fixed.