JoeMurray / org.civicoop.triggers

CiviCRM trigger extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CiviCRM Triggers and Actions

Explanation

This example will show what the trigger/action parameters are.

We want to achieve the following:

  • Add to the group 'Johns' (This group has id 6)
  • Every contact whose first name is equal to John
  • And who contributed something 7 days ago

###Trigger Rules

The trigger rules and the condition determine which entities to match for triggering

IDLabelNameEntity
20When firstname = Johnfirstname_johnContact
21When contribution completed 7 days agocontribution_completedContribution

###Trigger conditions

idTrigger rule IDFieldValueSpecial processingOperatorAggregate functionGrouping field
3020first_nameJohnfalse=
3121status_id1false=
3221receive_dateDATE_SUB(CUR_DATE() INTERVAL 7 DAYS)true=

###Action rules

The action is the action which is executed on a found entity. The action consist of calling the civicrm api.

idLabelNameAPI EntityAPI ActionAPI Parameters
40Add contact to group Johnadd_to_group_johnGroupContactCreategroup_id=6&contact_id={contact.id}

The API parameters can contain tokens which consist of curly brackets around them and the entity name with a dot for the field of the entity. e.g. {contribution.total_amount}

The entities refer back to the entities used in the trigger part. If you have multiple entities e.g. multiple groups you can use group one as {group1.id} and for the second group {group2.id}

###Rule Schedule

A rule schedule determines when a rule is scheduled for checking and executing the action

IDLabelNameAction rule IDScheduleis activeStart dateEnd date
50John to Johns (every morning at 7am)john_to_johns40Tomorrow +7 hours1

The schedule parameter is a php relative date format see http://www.php.net/manual/en/datetime.formats.relative.php for this fornat specification.

###Rule Schedule Trigger

The rule schedule trigger contains the linked triggers to a rule schedule.

IDRule Schedule IDTrigger rule IDLogic operator
1005020
1005021AND

Hooks

This extension implements several hooks. For a complete description of those hooks see docs/hooks.md

Data structure

See docs/dataStructure.md for a description of the data structure.

About

CiviCRM trigger extension

License:Other


Languages

Language:PHP 89.7%Language:Smarty 10.3%