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.
About this task
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.
Procedure
To create a dependency between two fields, add a Value
Changed hook to the parent field:
- Start the Designer.
-
In the 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.
The Designer indicates the type of editor you
are using in the title bar of the Designer window. Verify that you
are using the correct editor before adding or editing your code.
- 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.
What to do next
There
are additional steps to enable dependent fields for HCL Compass Web client. See Enabling dependent fields for HCL Compass Web.