Setting Custom Field Default Values

You can set your own default field values for any editable field that has default values and uses a character string, and thereby reduce the data entry effort required by your agency. You can set any date field to default to any date (as a character string) or to the current date.  

To change a field's default value, you must add a default attribute to the EntityAttribute element for the desired field in the custom business metadata, which can be accessed from the Entity Overview component. For any editable field, you can specify a default value of any alphanumeric character string, up to the maximum length of the field. For date fields, you can also specify a default value of "CURRENTDATE," which maps to the user's computer's current date.

Example 1

To set the Spec Book field to a default value of 2008, you would follow these steps:

  1. On the Entity Overview component, use the Quick Find search box to locate the Project entity.

  2. Click the Entity ID link in the project entity row.

    The system takes you to the Business Metadata Summary component for the Project entity.

  3. Click the Base Metadata tab.

  4. Locate and copy the following excerpt:

            <EntityAttribute id="SPECBOOK" type="char" key="false" label="Spec Book" defaultSortIndex="" defaultSortDirection="ASCENDING" default="" restricted="false" addendaRestricted="false" alwaysreadonly="false">
               <ValidationRules>
                 <Rule type="IsRequired">
                   <Arguments />
                 </Rule>
                 <Rule type="MaxLength">
                   <Arguments>
                     <Argument name="MaxAllowed">20</Argument>
                   </Arguments>
                 </Rule>
               </ValidationRules>
               <Information />
             </EntityAttribute>

  5. Click the Custom Metadata tab and paste the excerpt in the appropriate place.

  6. Add the "default" attribute in the excerpt so that the excerpt now looks like this:

            <EntityAttribute id="SPECBOOK" type="char" key="false" label="Spec Book" defaultSortIndex="" defaultSortDirection="ASCENDING" default="2008" restricted="false" addendaRestricted="false" alwaysreadonly="false">
               <ValidationRules>
                 <Rule type="IsRequired">
                   <Arguments />
                 </Rule>
                 <Rule type="MaxLength">
                   <Arguments>
                     <Argument name="MaxAllowed">20</Argument>
                   </Arguments>
                 </Rule>
               </ValidationRules>
               <Information />
             </EntityAttribute>

  7. Click the Save button.

Example 2

To set the Estimated Date field to always default to the current date, you would follow these steps:

  1. On the Entity Overview component, use the Quick Find search box to locate the Project entity.

  2. Click the Entity ID link in the project entity row.

    The system takes you to the Business Metadata Summary component for the Project entity.

  3. Click the Base Metadata tab.

  4. Locate and copy the following excerpt:

    <EntityAttribute id="ESTIMATED_DT" type="date" key="false" label="Estimated Date" defaultSortIndex="" defaultSortDirection="ASCENDING" default="" restricted="false" addendaRestricted="false" alwaysreadonly="false">
               <ValidationRules>
                 <Rule type="IsDatetime">
                   <Arguments />
                 </Rule>
               </ValidationRules>
               <Information />
             </EntityAttribute>

  5. Click the Custom Metadata tab and paste the excerpt in the appropriate place.

  6. Add the "default" attribute in the excerpt so that the excerpt now looks like this:

    <EntityAttribute id="ESTIMATED_DT" type="date" key="false" label="Estimated Date" defaultSortIndex="" defaultSortDirection="ASCENDING" default="CURRENTDATE" restricted="false" addendaRestricted="false" alwaysreadonly="false">
               <ValidationRules>
                 <Rule type="IsDatetime">
                   <Arguments />
                 </Rule>
               </ValidationRules>
               <Information />
             </EntityAttribute>

  7. Click the Save button.

Related topics:

Customizing Entities

Editing the Business Metadata

 

Blue bar indicating the end of the topic