Defining Database Events

Use the Rights info area to define which database events initiate which triggers (or workflows).

These triggers or workflows apply to all users (including the administrator) assigned these access rights as either their station, group, user or login role access rights.

When a database action initiates a trigger, the triggers is added to the trigger stack, which stores all triggers yet to be executed (see Processing Triggers on the Stack). Triggers are added to the stack in the order they are entered in the list. (Workflows entered in the Trigger info area (see below) are also added to the stack.) The order in which you enter triggers can therefore be important, see Inserting Database Events.

To define a database event as a trigger event:

  1. Switch to the Rights info area in the Rights module.
  2. Click in the Triggers cell of the desired trigger info area.

    The Trigger info area is displayed for the selected info area.

  3. Double-click on New Line to add a new trigger. Alternatively, click in the Workflow column in the new line to add a new workflow. The Load dialog box opens.
  4. Select a trigger or workflow.
  5. Click on OK.
  6. Click in the Index Relationship column to display the default index relationship between the trigger and target info areas, see Trigger and Target Info Areas when Updating, Displaying or Deleting Records. This index is used to access the target info area. If multiple indices are available, enable the check box next to the desired index to use it. The new index relationship is then displayed in the Index Relationship column.
  7. Click in the With Conditions cell to define a condition. The trigger is only executed if this condition is met, see Conditions in the Aurea CRM win User Manual.

    The condition is tested as soon as the trigger is initiated, and not only once the trigger is processed on the stack, see Processing Triggers on the Stack.

  8. Enable the New cell to initiate the trigger when a new record is added. The trigger is executed once the new record is saved. If a condition is defined in the With Conditions cell, the condition is tested before the trigger is executed.

    If the Plausibility Check option is enabled in the trigger, the trigger is initiated immediately after the record is added (i.e. before saving).

  9. Enable the Upd cell to initiate the trigger when an existing record is updated. The trigger is executed once the record is saved.

    If the Plausibility Check option is enabled in the trigger, the trigger is initiated immediately once data is entered (i.e. before saving).

    Note: Changes are only present if the record has changed since the last time it was saved.If the Plausibility Check option is enabled in a trigger, the trigger is initiated whenever records are edited and added, irrespective of which options are enabled (New, Upd). To determine that the trigger should only be executed for new records, for example, define the condition New = "<empty>" in the With Conditions field. Conversely, if the record is being updated, the New field contains data.
  10. Enable the Del cell to initiate the trigger when a record is deleted. If a condition is defined in the With Conditions cell, the condition is tested before the trigger is executed.
    Note: Triggers are only initiated after a record is deleted and therefore cannot access information stored in the record's child records (as these records no longer exist).
  11. If you have enabled the Upd column, you can define conditions in the Old Condition column that are applied to the record before the trigger is executed. This condition does not affect the New or Del cells.
  12. If you enable the Upd, Old Condition and With Conditions cells, the trigger is only executed if the record was changed from the status defined under Old Condition to the status defined under With Conditions.

    Example: A trigger should be used to send an e-mail if the Status of an activity record is changed from "Scheduled" (Old Condition) to "Completed" (With Conditions).

  13. If the Upd cell is enabled, you can use the Upd Fields column to determine that the trigger is only initiated after certain fields are updated.

    Click in the Upd Fields cell to open the Trigger Fields info area which displays all fields in the info area.

    • All the fields with a tick in only the Trigger cell (and not the Optional cell) must be changed before the trigger is initiated.
    • At least one of the fields with a tick in the Optional column must be changed before the trigger is initiated.

    In the above example, the trigger is only initiated once changes are made to the Date field and at least one of either the Activity or Status fields (or both).

    This condition does not affect the New and Del columns.

  14. Click in the Properties cell to define inheritance settings for the trigger or workflow and determine how the workflow/trigger is handled by the stack, see Further Settings for Triggers and Workflows.
  15. Click on (OK) to return to the Triggers mask.
  16. Click on (OK) to return to the Rights info area.
  17. Save the access rights.

    Triggers and workflows are executed in the order they are entered, see Inserting Database Events.