Defining Trigger Functions

You can use triggers to enter values in the database.

You can transfer fixed values, variable values (date, rep) and the contents of other fields (references). Furthermore, you can carry out arithmetic and string operations and determine conditions under which the fields should be updated.

You can process a field several times in one trigger, allowing for intermediate calculations and if-then-else chains.

To define trigger functions:

  1. Define a new trigger or load a trigger using (Load), see Defining Triggers.
  2. Click on New Line in the Field Name column.

    A dialog box is displayed with all available fields. The fields listed are dependent on the Info Area and Action defined in the upper section of the mask.

    Fields which cannot be selected in this column (Z-fields, see Data Types in Aurea CRM) can be selected in the Direct Reference column (e.g. the Person and Company fields in the Activity info area).

  3. Select the fields whose contents should be changed by the trigger and click OK.
  4. Define the desired changes in the Function, Field Contents, Reference Function, Variable , Direct Reference or Reference columns.
    Note: The columns are applied from right to left: Reference – Direct Reference – Variable – Field Contents.
    • Select an operator in the Function column to perform string or arithmetic operations, see Functions. The current field contents are combined with the contents in the Field Contents, Variable, Direct Reference or Reference columns using this operator. If you do not select a function, the current field contents are overwritten by the value you entered in the Field Contents, Variable, Direct Reference or Reference columns.
    • Use the Field Contents column to define fixed content to be written to the field by the trigger. The system immediately checks whether the value entered is in a valid format for the field, see Field Types. Invalid values cannot be saved.

      Double-click to open the catalog for catalog fields. Double-click to access the calendar for date fields.

      Use variable expressions to enter field contents that are dependent on when the trigger was initiated or by whom (e.g. $curDay for the current date or $curSuperior for the current rep's superior), see Default Variables and User-defined Variables.

      To create line breaks in text fields: Use "\10" for LF, "\13\10" for CRLF. (Use "\13\10" to automatically enter the Line Break 1-3 fields in company records.)

    • Use the Reference Function column to:

      - select functions that are applied to a date or time, see Date and Time.

      - enter regular expressions, see Regular Expressions.

    • Use the Variable column to define field contents that depend on the time or date the trigger is executed or the current user, see Default Variables and User-defined Variables. When creating the trigger, the system does not test whether the content is in a valid format for the field type. You need to ensure this yourself.
    • Use the Direct Reference column to copy or edit fields in the record processed by the trigger. When creating the trigger, the system does not check whether the content is in a valid format for the target field. You need to ensure this yourself.

      Fields which cannot be selected in the Field column can be selected in the Direct Reference column (e.g. the Person and Company fields in the Activity info area).

    • Use the Reference column to copy data from other info areas. If you click in a cell in this column, the Field Reference level is opened, see Field References.

      Once you have defined a reference, a tick is displayed in the cell. You can then click in the field to edit or delete the reference.

  5. Use the With Conditions column to determine that changes to this field are only applied if the target record meets specific conditions, see Conditions in the Aurea CRM win User Manual.

    Once you have defined a condition, a tick is displayed in the cell. You can then click in the field to edit or delete the condition.

    Note: If you apply conditions to fields copied using references within the same trigger, the condition is applied to the record before the reference is copied. For example, if you want to copy fields from a company to a person and fill in other fields in the Person record based on the contents of these fields, this must either be done using two separate triggers or by executing the trigger twice, i.e. call the trigger a second time from within the trigger.
  6. Use the Message column to enter messages that are displayed when this line is changing the contents of fields.

    Requirements:

    • The Plausibility Check option must be enabled.
    • The trigger must be initiated via a database action, not a button.
  7. Click on New Line in the Field Name column to define further functions.
    Note: The lines are executed in the order they are defined.
  8. Save the trigger.