Define field behavior
In this exercise you will set the behavior for two of the fields that you added to the Defect record in the Add fields exercise. A field behavior indicates whether users can or must enter a value in the field. You can set a field behavior to one of the following choices:
- Read Only
- Mandatory
- Optional
- Use Hook
The Use Hook option refers to a hook script that you can write to determine each user's level of access to the field.
Before you can make changes to the schema, you must check out the schema. If the schema is not checked out, perform the following steps:
- In the Designer, click . The Open Schema window opens.
- Select Checkout a schema to edit or continue editing previously saved work. Select my_sample_schema from the table of schemas. If the schema is checked out, and you are continuing work from a previous editing session, click Finish. If the schema is not checked out, click Next and then Finish.
To set the behavior for all states of the User_ID field to Mandatory:
- In the Designer, expand the Record Types folder, the Defect folder, and the States and Actions folder.
- Double-click Behaviors to open the Behaviors grid. For state-based record types you can set different behaviors for different states in the state transition model for the record type. For example, you might want to set the Resolution field to mandatory for the Resolved state to require users to enter a description of how they resolved the defect when they transition it to the Resolved state.
- Scroll to the User_ID row in the grid. Select all cells in the row. Right-click in one of the cells and select Mandatory.
- Scroll to the Action_reason row in the grid. Right-click in the cell for the Reassigned state and select Mandatory. Leave the other states for Action_reason set to OPTIONAL. When users attempt to reassign a defect, they will be required to enter a value in this field.
The last column on the right side of the grid specifies the default behavior. If you have not previously set the field behavior, it is set to the default value. When you add a state to a record type, the field behavior for that state is set to the default value.