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:
- Display the 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.)
- When you are finished, click to check the syntax of your script
code.