Evergreen in Action

Sending reminders to your users

Evergreen allows you to set up automated notifications and actions to respond to events in your system. An example of an event might be an item becoming overdue. An example of an action might be sending an email notification to users.  

The Action Triggers and Notification module can be found in the staff client by navigating to Admin > Local Administration > Notifications / Action Triggers

Creating notifications

Action Triggers and Notifications are created from within the staff client.

Before creating a new notification, check the existing notifications to see if your  desired notification can be cloned from an existing one. 

  1. From the top menu, select Admin > Local Administration > Notifications / Action triggers
  2. Click on the New button
  3. Select an Owning Library from the dropdown box
  4. Create a unique Name for your new action trigger
  5. Select the Hook from the dropdown box
  6. Check the Enabled check box
  7. Set the Processing Delay in the appropriate format. For example, to set the delay to 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 Validator, Reactor, Failure Cleanup and Success Cleanup from their respective dropdown boxes
  10. Enter text in the Template text box if required. These are for email messages. (You may have to scroll down in the staff client window to see this.)
  11. Once you are satisfied with your new event trigger, click the Save button located at the bottom of the form

Cloning notifications

Cloning notifications is a great way to create a new notification quickly based on existing ones. To Clone notifications follow these steps: 

  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 with open. Notice that the fields will be populated with content from the cloned action trigger. Edit as necessary and give the action trigger a unique Name.

Deleting notifications

  1. Before you delete a notification remember that you can disable a notification so it is inactive without deleting it.  
  2. Check the check box next to the action trigger you wish to delete
  3. Click Delete Selected on the top left of the page.

    Editing email content for notifications 

    There are several notifications already created in Evergreen by default, including several for overdue or pre-due events.  Text can be edited for email notifications. To edit the text in an existing notification:

    1. Navigate to  Admin > Local Administration > Notifications / Action triggers
    2. Open the event by double clicking on it from the list of events.
    3. Edit the text in the Template field and click Save

    Processing notifications

    Action triggers and notifications will not be processed until the action trigger runner script is run from the command line or a cron job. 

    To process the action triggers, an Evergreen administrator will need to run the trigger processing script /openils/bin/action_trigger_runner.pl from the command line. This can and should be be set up as a cron job scheduled to run automatically.

    This script has a number of important options:

    --osrf-config=<config_file>: OpenSRF core config file.  Defaults to:  /openils/conf/opensrf_core.xml

    --custom-filters=<filter_file>: File containing a JSON Object which describes any hooks that should use a user-defined filter to find their target objects.  Defaults to:

    --run-pending: Run pending events

    --process-hooks: Create hook events

     --max-sleep=<seconds> When in process-hooks mode, wait up to <seconds> for the lock file to go away.  Defaults to 3600 (1 hour).

    --hooks=hook1[,hook2,hook3,...]: Define which hooks to create events for.  If none are defined, it defaults to the list of hooks defined in the --custom-filters option.

    --granularity=<label>: Run events with {label} granularity setting, or no granularity setting

    --granularity-only: Used in combination with --granularity, prevents the running of events with no granularity setting

    --debug-stdout: Print server responses to stdout (as JSON) for debugging

     --lock-file=<file_name>: Lock file

    For example, to run all pending actions, enter the following command at the command line:

    perl action_trigger_runner.pl --osrf-config=/openils/conf/opensrf_core.xml --run-pending --process-hooks

    If you want to run all actions under a specific hook, enter the following command:

     perl action_trigger_runner.pl --osrf-config \
    /openils/conf/opensrf_core.xml --hooks checkout.due

    One of the more useful options is granularity since this goes hand and hand with your cron job scheduling. Granularity options include Hourly, Daily, Weekly, Monthly and Yearly

    For the action triggers to be processed, ensure that they are set to enabled from the staff client.