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
ID | Label | Name | Entity |
---|---|---|---|
20 | When firstname = John | firstname_john | Contact |
21 | When contribution completed 7 days ago | contribution_completed | Contribution |
###Trigger conditions
id | Trigger rule ID | Field | Value | Special processing | Operator | Aggregate function | Grouping field |
---|---|---|---|---|---|---|---|
30 | 20 | first_name | John | false | = | ||
31 | 21 | status_id | 1 | false | = | ||
32 | 21 | receive_date | DATE_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.
id | Label | Name | API Entity | API Action | API Parameters |
---|---|---|---|---|---|
40 | Add contact to group John | add_to_group_john | GroupContact | Create | group_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
ID | Label | Name | Action rule ID | Schedule | is active | Start date | End date |
---|---|---|---|---|---|---|---|
50 | John to Johns (every morning at 7am) | john_to_johns | 40 | Tomorrow +7 hours | 1 |
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.
ID | Rule Schedule ID | Trigger rule ID | Logic operator |
---|---|---|---|
100 | 50 | 20 | |
100 | 50 | 21 | AND |
This extension implements several hooks. For a complete description of those hooks see docs/hooks.md
See docs/dataStructure.md for a description of the data structure.