Creating Action Triggers

  1. From the top menu, select AdministrationLocal AdministrationNotifications / Action triggers.
  2. Click on the New button.

    New Event Definition
  3. Select an Owning Library.
  4. Create a unique Name for your new action trigger.
  5. Select the Hook.
  6. Check the Enabled check box.
  7. Set the Processing Delay in the appropriate format. E.g. 7 days to run 7 days from the trigger event or 00:01:00 to run 1 hour after the Processing Delay Context Field.
  8. Set the Processing Delay Context Field and Processing Group Context Field.
  9. Select the Reactor and Validator.
  10. Set the Event Repeatability Delay.
  11. Select the Failure Cleanup and Granularity.
  12. Set the Max Event Validity Delay.

    Event Definition Details
  13. If you wish to send a User Message through the Message Center, set a Message Library Path. Enter text in the Message Template. Enter a title for this message in Message Title, and set a value in Message User Path.
  14. Select the Opt-In Setting Type.
  15. Set the Opt-In User Field.
  16. Select the Success Cleanup.

    Event Definition Details
  17. Enter text in the Template text box if required. These are for email messages. Here is a sample template for sending 90 day overdue notices:

    [%- USE date -%]
    [%- user = target.0.usr -%]
    To: [%- params.recipient_email || user.email %]
    From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %]
    Subject: Overdue Items Marked Lost
    Auto-Submitted: auto-generated
    Dear [% user.family_name %], [% user.first_given_name %]
    The following items are 90 days overdue and have been marked LOST.
    [%- params.recipient_email || user.email %][%- params.sender_email || default_sender %]
    [% FOR circ IN target %]
      Title: [% circ.target_copy.call_number.record.simple_record.title %]
      Barcode: [% circ.target_copy.barcode %]
      Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
      Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
      Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
      Library: [% circ.circ_lib.name %]
    [% END %]
    [% FOR circ IN target %]
      Title: [% circ.target_copy.call_number.record.simple_record.title %]
      Barcode: [% circ.target_copy.barcode %]
      Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
      Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
      Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
      Library: [% circ.circ_lib.name %]
    [% END %]
  18. Once you are satisfied with your new event trigger, click the Save button located at the bottom of the form.

Tip

A quick and easy way to create new action triggers is to clone an existing action trigger.

Cloning Existing Action Triggers

  1. Check the check box next to the action trigger you wish to clone.
  2. Click Clone Selected on the top left of the page.
  3. An editing window will open. Notice that the fields will be populated with content from the cloned action trigger. Edit as necessary and give the new action trigger a unique Name.
  4. Click Save.

Editing Action Triggers

  1. Double-click on the action trigger you wish to edit.
  2. The edit screen will appear. When you are finished editing, click Save at the bottom of the form. Or click Cancel to exit the screen without saving.

Note

Before deleting an action trigger, you should consider disabling it through the editing form. This way you can keep it for future use or cloning.

Deleting Action Triggers

  1. Check the check box next to the action trigger you wish to delete
  2. Click Delete Selected on the top-right of the page.

Testing Action Triggers

  1. Go to the list of action triggers.
  2. Click on the blue link text for the action trigger you’d like to test.

    Blue Link Text
  3. Go to the Test tab.
  4. If there is a test available, fill in the required information.
  5. View the output of the test.
Test Output

Warning

If you are testing an email or SMS notification, use a test account and email as an example. Using the Test feature will actually result in the notification being sent if configured correctly. Similarly, use a test item or barcode when testing a circulation-based event like Mark Lost since the test will mark the item as lost.

Hooks

Hooks define the Fieldmapper class in the core_type column off of which the rest of the field definitions “hang”.

Table 2. Hooks

Field

Description

Hook Key

A unique name given to the hook.

Core Type

Used to link the action trigger to the IDL class in fm_IDL.xml

Description

Text to describe the purpose of the hook.

Passive

Indicates whether or not an event is created by direct user action or is circumstantial.

You may also create, edit and delete Hooks but the Core Type must refer to an IDL class in the fm_IDL.xml file.

Reactors

Reactors link the trigger definition to the action to be carried out.

Table 3. Action Trigger Reactors

Field

Description

Module Name

The name of the Module to run if the action trigger is validated. It must be defined as a subroutine in /openils/lib/perl5/OpenILS/Application/Trigger/Reactor.pm or as a module in /openils/lib/perl5/OpenILS/Application/Trigger/Reactor/*.pm.

Description

Description of the Action to be carried out.

You may also create, edit and delete Reactors. Just remember that there must be an associated subroutine or module in the Reactor Perl module.

Validators

Validators set the validation test to be preformed to determine whether the action trigger is executed.

Table 4. Action Trigger Validators

Field

Description

Module Name

The name of the subroutine in /openils/lib/perl5/OpenILS/Application/Trigger/Reactor.pm to validate the action trigger.

Description

Description of validation test to run.

You may also create, edit and delete Validators. Just remember that their must be an associated subroutine in the Reactor.pm Perl module.