Action Triggersaction triggersAction Triggers were introduced to Evergreen in 1.6. They allow administrators the ability to set up actions for specific events. They are useful for notification events such as
hold notifications.To access the Action Triggers module, select
AdminLocal AdministrationNotifications / Action triggersYou must have Local Administrator permissions to access the Action Triggers module.You will notice four tabs on this page: Event Definitions, Hooks,
Reactors and Validators.Event Definitionsaction triggersevent definitionsEvent Definitions is the main tab and contains the key fields when working with action triggers. These fields include:
Action Trigger Event DefinitionsFieldDescriptionOwning libraryThe shortname of the library for which the action / trigger / hook is defined.NameThe name of the trigger event, that links to a trigger event environment containing a set of fields
that will be returned to the Validators / Reactors for processing.HooksThe name of the trigger for the trigger event. The underlying action_trigger.hook table defines the Fieldmapper
class in the core_type column off of which the rest of the field definitions hang. EnabledSets the given trigger as enabled or disabled. This must be set to enabled for the Action trigger to run.Processing DelayDefines how long after a given trigger / hook event has occurred before the associated action (Reactor)
will be taken.Processing Delay FieldDefines the field associated with the event on which the processing delay is calculated. For example, the processing delay
context field on the hold.capture hook (which has a core_type of ahr) is capture_time.Processing Group Context FieldUsed to batch actions based on its associated group.ValidatorsThe subroutines receive the trigger environment as an argument (see the linked Name for
the environment definition) and returns either 1 if the validator is true or 0
if the validator returns false.ReactorsLinks the action trigger to the Reactor.Max Event Validity DelayDefine the threshold for how far back the action_trigger_runner.pl script should reach to generate
a batch of events.
Creating Action Triggersaction triggerscreatingFrom the top menu, select
AdminLocal AdministrationNotifications / Action triggersClick on the New button.Select an Owning Library.Create a unique Name for your new action trigger.Select the Hook.Check the Enabled check box.Create a unique Name for your new action trigger.Set the Processing Delay in the appropriate format. Eg. 7 days to run 7 days from the trigger event
or 00:01:00 to run 1 hour after the Processing Delay Context Field.Set the Processing Delay Context Field and Processing Group Context Field.Select the Validator, Reactor, Failure Cleanup and Success Cleanup.
Set the Processing Delay Context Field and Processing Group Context Field.Enter text in the Template text box if required. These are for email messages. Here is an sample
template for sending 90 day overdue notices:Once you are satisfied with your new event trigger , click the Save button located at the bottom of the
formA quick and easy way to create new action triggers is to clone an existing action trigger.Cloning Existing Action TriggersCheck the check box next to the action trigger you wish to cloneClick the Clone Selected on the top left of the page.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 new action trigger a unique Name.Click Save.Editing Action TriggersCheck the check box next to the action trigger you wish to deleteClick the Delete Selected on the top left of the page.Before deleting an action trigger, you should consider disabling it through the editing form. This way you can simply enable it if you decide that you would like to use
the action trigger in the future.Deleting Action TriggersCheck the check box next to the action trigger you wish to deleteClick the Delete Selected on the top left of the page.Hooksaction triggershooksHooks define the Fieldmapper class in the core_type column off of which the rest of the field definitions hang.
HooksFieldDescriptionHook KeyA unique name given to the hook.Core TypeUsed to link the action trigger to the IDL class in fm_IDL.xmlDescriptionText to describe the purpose of the hook. PassiveIndicates 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.Reactorsaction triggersreactorsReactors link the trigger definition to the action to be carried out.
Action Trigger ReactorsFieldDescriptionModule NameThe 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.DescriptionDescription of the Action to be carried out.
You may also create, edit and delete Reactors. Just remember that their must be an associated subroutine or module in the Reactor Perl module.Validatorsaction triggersvalidatorsValidators set the validation test to be preformed to determine whether the action trigger is executed.
Action Trigger ValidatorsFieldDescriptionModule NameThe name of the subroutine in
/openils/lib/perl5/OpenILS/Application/Trigger/Reactor.pm to validate the action trigger.DescriptionDescription 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.Processing Action Triggersaction triggersprocessingTo run the action triggers, an Evergreen administrator will need to run the trigger processing script /openils/bin/action_trigger_runner.pl
. This should be set up as a cron job to run
periodically.You have several options when running the script:: Run the pending events.: Create hook events: OpenSRF core config file. Defaults to:
/openils/conf/opensrf_core.xml.: File containing a JSON Object which describes any hooks that should
use a user-defined filter to find their target objects. Defaults to: /openils/conf/action_trigger_filters.json: When in process-hooks mode, wait up to [seconds] for the lock file to go away.
Defaults to 3600 (1 hour).: Define which hooks to create events for. If none are defined, it defaults to the list of hooks defined
in the option.: Print server responses to stdout (as JSON) for debugging.: Sets the lock file for the process.: Show help information.