Action hooks

This topic explains the concept of a HCL Compass Web client action hook.

Action hooks can control who has permission to change record values and validate user entries before they are committed to the database. Action hooks can also validate the entire record and send e-mail notification when the action is complete.

The scope of an action hook is the current record. The supported types of action hooks are listed in the following table in the order in which they run.

Action hook Use

Access Control

Runs when the action is about to start.

Returns a Boolean value that indicates whether the specified user can initiate the specified action on a record. This hook is called before the user performs the action. For nested actions, an access control hook is not run. You can write an access-control hook as a VBScript or Perl subroutine. To run a primary action (modify, submit, delete, import), the current user must be in the access control list for the primary action and for all the base actions. See Restricting user access to actions.

Initialization

Runs when the action starts.

Sets initial field values (or any task you specify). Allows complex initialization of a record. You can use this hook to set up field values before an action begins. This hook is called after the action has been initialized but before the contents of the record are displayed in a form. You must write an initialization hook as a script subroutine.

Validation

Runs when the user commits the action.

Validates the field values you specify. If the user types data that is not valid, the user is prompted for valid data. You can use this hook to check conditions that are difficult to verify inside the individual field validation hooks. For example, you can use this hook to verify information across a group of fields. This hook runs before any changes are committed to the database. Validation hooks must use a script. See Editing a dynamic list .

Commit

Runs immediately before the transaction is committed to the database.

Links an action on multiple records into a single transaction (for example, resolving all the duplicates of a change request when the original is resolved). Updates a set of external data sources to keep them consistent with the database contents. This hook is called after the updates to the current record have been recorded in the database, but before the update transaction is committed. The Commit hook allows the transaction to be extended to include updates to additional records (for example, resolving all the duplicates of a change request when the original is resolved).
Note: Since all updates to the current record are recorded before this hook runs, a call to the SetFieldValue method on the current record will have no effect in this hook. You should use the Validation action hook to modify the current record in the transaction. However, you can use the Commit hook to update records that are related to the current record as part of a single transaction.

Notification

Runs after the transaction is committed.

Starts an action that notifies users when an action is performed. See HCL Compass email . Notification hooks must use a script.

For more information, see: