Creating a dependency between fields

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:
  1. Start the Designer.
  2. In the Schema Repository Explorer view, expand the Record Types folder in your schema and then expand a record type.
  3. Click on the Fields node to open the Record Fields grid.
  4. Click the Value Changed cell of the parent field.
  5. Click the down arrow and click SCRIPTS > Basic or SCRIPTS > Perl.

    If Instant Edit Mode is enabled, the Designer starts the Script editor. To enable or disable instant editing, click Edit > Instant Edit Mode. 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.

  6. 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.