I threw this little quick reference card together because there are times when referencing a Mode is easier to do by the enum Value rather than the enum Name. With this in mind here are the Power Apps FormMode and DisplayMode values as well as their default mapping to each other. And as a bit of a bonus I went ahead and threw in the SharePoint Framework values as well, for those times when you may be working in the “teal zone”.
Example use:
Switch(
Form1.Mode,
0,
"The parent form mode is Edit",
1,
"The parent form mode is New",
2,
"The parent form mode is View",
"Default response"
)
A valid counterpoint to the use of enum Values over enum Names is that the values are not easily readable in the code. Without the text outputs in the above switch statement, it wouldn’t be easy to tell which Form modes were being evaluated. This is a trade-off for using the shorter, easier to type values when coding versus the longer but more clear names.
Personally, I’ve done both in the past and technically speaking they both work perfectly and are valid methods.
What do you think? Have you ever tried using the using the enum Values for these mode properties?