Using hooks in HCL Compass Web

HCL Compass Web software supports a subset of the full hook functionality, which a schema developer can set up.

Hooks created in the HCL Compass schema run on the computers that run the HCL Compass server. Keep in mind the following points when using hooks with HCL Compass Web:
  • You cannot use Visual Basic or Perl message boxes like you can on the desktop client. However, you can display information, warning, and error message boxes by defining a custom message or opening a prepopulated record form. See Generating a custom message and Opening a prepopulated form.
  • Context-menu hooks are not supported in the HCL Compass Web application.
  • You can use hooks to detect a web session.
The following types of hooks are supported:
  • Field hooks
    • Choice List
      Sets the choices associated with a field. When a choice list for a field is determined by another field, the other field must list the target field as its web dependent field. The control types that can be displayed for Choice List hook fields are combination box, drop-down combination box, and drop-down list.
      Default Value
      Runs when a submit form is displayed. It does not run when a record is submitted by clicking Save.
      Permission
      Runs only when the form is first displayed in edit mode.
      Validation
      Runs only when the form is saved. It does not run when the user changes a field value. Validation hooks can run at different times depending on the form control type, and whether the field property is specified as web dependent. For more information, see Special considerations for field hooks.
      Value Changed
      Runs when the value of the given field changes in the following form control types: drop-down list, drop-down combination box, and combination box. Value Changed hooks can run at different times depending on the form control type, and whether the field property is specified as web dependent. For more information, see Special considerations for field hooks.
  • Action hooks
    • Access Control
    • Initialization
    • Validation
    • Commit
    • Notification
  • Record scripts
    • Record script alias actions display in a drop-down list on the Utilities button in a record in a specific state.
    • Hook action is set on the Button Hooks tab of the button control Properties, in the Enable for webarea.
    • Context Menu hooks are not supported on any form control.
  • Global scripts

Special considerations for field hooks

The behavior of Value Changed and Validation field hooks depends on the form control type and property settings for the target fields. Review the following special considerations to understand when the hooks run, and how changes are made visible to users for different form control types.

Value Changed

A Value Changed field hook runs immediately after a user changes the value in the following form fields:

Field type Form control
REFERENCE
  • Combination box
  • Drop-down combination box
  • Drop-down list
REFERENCE_LIST List
SHORT_STRING
  • Drop-down combination box
  • Drop-down list
Note: These form controls require a web dependent field association in order for the Value Changed hook to run immediately.
A Value Changed hook runs the next time the browser communicates with the HCL Compass server when the hook is set on a SHORT_STRING field type with one of the following types of form controls:
  • Combination box
  • Drop-down combination box
  • Drop-down list

Moving between tabs on a form in the browser does not cause the browser to communicate with the HCL Compass Server.

Validation field hooks

A Validation hook runs immediately on the HCL Compass Web client, but the form must be refreshed to see the results.

To create a Refresh button:

  1. Create a record script hook with no code inside it. Name the hook Refresh.
  2. Create a button on the form. Label the button Refresh.
  3. Right-click the button, and then click Properties.
  4. On the Button Hooks tab, in the Hooks area, select the Refresh record script from the Click Hook list.
  5. In the Enable for web area, select Click Hook.
The HCL Compass Web client user must click the Refresh button to see the results of the Validation hook.