How to: Set Default Value for Enum Picker control in Dialogs
Goal
In case when EnumPicker is used in a Dialog, and the control Bound Property associated with the Schema Attribute of Pickup value, the System always preset the initial value of the control by the Value defined in Schema. In some use cases for two different Dialogs which have Enum Control referencing the same Schema Property, two different Default Values needs to be set, what makes it impossible to solve this requirement by changing the Default Value in Schema. Using Enum Control propety "Default Value" also does not help, as the Initial Value is predefined by the Server component (Schema), and Client cannot recognize it.
To meet these requirement the Layout Designer Calculated field has to be user.
As an example, let us change the Default Value of the Incident, Notification Mode control. Out of the box it is preselect by value "Always" (SVMIncidentPickupSendNotifications, value = 1). Make a change which set Create and Close (2), on creating a new Incident
First Step: Adjust Enum Picker Bound Property value
1. Click on Enum Picker control in Canvas, and in Properties click on Value property
2. In Property Dialog, proceed to Advanced Mode
3. To track whether the Dialog is new, and the Object not saved yet, add in watchable property "IsNew"
4. Define an Expression which returns new Default value of the Property, when Dialog is new, and the Value was not changed yet (previous property value equals to current value).
if(isNew.$value && $value == 1 && $oldValue == $value) { return 2; } return $value;