Basic Customization > User Interface Customization > Presenting Information in the UI > Attribute Customization > Windchill Attribute Customization Overview > Common Attribute Customization Procedures > Default Values
  
Default Values
You want to specify a default values for attributes.
Solution Elements
Element
Description
initialValue
A property used to specify default value(s) for an attribute. Applies to modeled attributes only.
See the javadoc for com.ptc.windchill.annotations.metadata.GeneratedProperty and Modeling Business Objects for more information.
Default Value
A configuration in the Type and Attribute Management utility.
See Default Values Tab for more information.
Object Initialization Rule
See Object Initialization Rules for more information.
Default Value Display Mode
A property used to configure how default values will be displayed in the UI. See “Default Value Display Mode” in Configuration Points for more information.
Intended Outcome
Default values are presented in the UI in one of these three modes and/or, default values are persisted automatically:
Default value button
Pre-populate the field with the default value
Do not display default value
Solution
You want to specify a default values for attributes.
The configurations required to achieve the different kinds of behavior are listed below:
If you want to…..
Configuration
Provide default value(s) for use in create UI only.
You do not want this value to be automatically persisted when a value is not provided in the UI.
For a modeled attribute, use the initial value property
For global and local attributes, provide the default value in the Type and Attribute Management utility.
See Default Values Tab for more information.
Provide default value(s)s for use in the Create UI and persistence
You want this value to be automatically persisted for that attribute when a value is not provided until the point of persistence.
Specify the default values using an Object Initialization Rule.
Provide default values for attributes that are not displayed in the Create UI and use this value for persistence
This applies when you want to create an object programmatically (without a UI) or, when some attributes of an object are not added to the Create UI of an attribute.
Specify the default values using an Object Initialization Rule.
Specify how default values should be presented in the UI
Use the Default Value Display Mode property.
Limitations
The default value specified in an Object Initialization Rule will not be reflected in the Type and Attribute Management utility.
The value set on an attribute during persistence is the value displayed for that attribute in the UI. So when a default value is specified in the Modeled class or the Type and Attribute Management utility, this value will be used only for displaying in the UI. The default value will not be automatically set on an attribute during persistence unless the default value was displayed in the UI as the value of the attribute using one of the methods used for displaying the default value. Only the default values specified using an Object Initialization Rule will be automatically saved with the default value.