This topic explains the concept of a ClearQuest® field hook.
A
field hook is useful for an event that affects a particular field
within the record. A field hook can set an initial value, respond
to events when a field value changes, enforce access permissions that
permit only the user groups that you specify to change field values,
and validate the values that users provide.
The
scope of a field hook is the current field within the current record.
The following types of field hooks are supported:
- Field hook
- Description
- Choice List
- Returns
a set of valid values. Use this hook with fields that are displayed
using a list-type control, such as a list box or combo box. You can
also provide values without scripting by using a constant or a dynamic
list. See Creating a choice
list for a field .
- Default Value
- Sets
the initial value of the field. This hook is called at the beginning
of a Submit action. You can write a default-value hook with a script
subroutine. You can also assign a constant value as the default value.
- Permission
- Returns
one of the BehaviorType constants that indicates the user's access
to the field. Use this hook to force workflow and/or security. (See
the IBM Rational ClearQuest API Reference for
enumerated constants.) If you add a Permission hook to a field, you
must modify the Behaviors grid so that at least one field behavior
is set to USE_HOOK. Failure to do this causes a validation error.
- Validation
- Validates
the contents of the field. This hook is called when the value changes,
to provide the user with immediate feedback about the validity of
the field contents before committing the record to the database.
- Value Changed
- Responds
to changes in the value of a field. Use this hook to update other
fields (for example, dependent lists). After this hook runs, any field
that the script has modified is validated by calling the Validation
hook (if any) for the field.
Hooks are run according to the rules specified in Execution order of field and action
hooks.