You can create a dependency between two fields so that when the
value of the parent field changes, the value of the child field (the dependent
field) changes also.
When designing your schema, plan
these field dependencies carefully. Dependent fields require the use of hooks,
which can introduce runtime errors if not written correctly.
To create
a dependency between two fields, add a Value Changed hook to the parent field:
- Start the Designer.
- In the ClearQuest Schema Repository Explorer view,
expand the Record Types folder in your schema and then
expand a record type.
- Click on the Fields node to open the Record
Fields grid.
- Click the Value Changed cell of the parent
field.
- Click the down arrow and click or .
If Instant Edit
Mode is enabled, the Designer starts the Script editor. To enable or disable
instant editing, click . If necessary, double-click the cell to
start the Script editor.
- In the Script editor, write a script that uses the value of the
parent field to set the value of the child field. (For an example of setting
a parent value based on child values, see Action hook for setting the value of a parent record.
- When you are finished, click to check the syntax of your
script code.