CiviCRM integration with Drupal Rules module

Pubblicato
2009-12-13 07:40
Written by
lobo - member of the CiviCRM community - view blog guidelines
Workflow has been an important piece missing from CiviCRM. We figured that integrating with the Rules module in Drupal would address this problem. I decided to tackle it on as a weekend project :) Kudos to the rules developer, Wolfgang Zeigler for designing AND documenting an excellent module. The developer documentation is very comprehensive and along with the integration modules, i was able to write an integration module in a few hours. The source code for the module can be found in our svn repository We hope to address and answer some of the integration questions with the community, similar to how the Views Integration Module has been developed. CiviCRM has got pretty good hook support, so I suspect adding extensive rules support is very feasible, i.e. fire rules based on CiviCRM hooks. We need to answer a few other questions to help us move this integration forward in a fruitful manner:
  • Data types to expose? Exposing all the top level CiviCRM objects as data types makes sense out here. Pretty much the same set of objects/tables that Views exposes (Contact, Contribution, Participant, Member, Activity)
  • Events to fire? Firing a rules event for all operations (insert,update,delete and view) on the above objects seems reasonable. We should also fire an event on a form submit (so an action could redirect the user to a different page)
  • Default actions? Some basic actions can be: add/remove from a group / tag, create a "object", send email with the object values, log to table/file, create/update an activity to reflect the change made (suggestion by DaveJ)
  • Default conditions? Compare two objects, contact in group/tag, object with value V in field F
  • Passing variables to other actions? This is a useful feature and should allow us to pass data from one action to the other. I suspect we will use this extensively as we add more actions and conditions.
I'm struggling a bit with actions / conditions that make sense and are useful. Let me know if you have any ideas on what will be useful in this context. If you can help build out this module and implement some of the functionality above that would be great and highly appreciated. Ping me on IRC if you can help. This definitely has the potential to take CiviCRM up to another level :)
Filed under

Comments

Great stuff, Lobo!

Creating or updating an Activity could be a really useful action. E.g. log in Civi that a user has completed a webform or content profile, submitted a comment...

Dave J

a few ideas:

Treat CiviCase Activities and ActivitySets as states, so that we can mimic the "change state from X -> Y" behavior. For example, it would be great to "send an email to case manager and creator" when case "changes state from ActivityType1 to ActivityTypeN"

Not sure from your post if you've covered this already, but "send an email" actions to any of the CiviCRM roles/groups would be great. Same with reporting - noticed that wasn't on your top level list (so "run report X after number of contributions for this month = X").

It may be that most of this is covered by your default conditions, but wanted to throw out a few examples just to make sure :)

One of the triggers I am looking for is:

Complete registration for an CiviCRM event (filter by event type). I have a situation where we want to have registration for a webinar through the civiEvent module that then triggers a php action to curl to an external website.

THX
Cas

I am trying to add a method that will make contributions and event registration to be credit to a household (contributions - soft credtied to an individual). I am working adding a rule based on contribution create and event registration. I will post when I have it done.

It would be useful to be able to tie contact field updates and activities to create a more flexible form of audit log:

1. Let the user specify a given custom field (condition), and an activity type to create when that field is updated (action).

2. Let the user specify a given activity type (condition), and a given custom field to update when that activity is created (action).

Use case 1 is a straightforward audit trail. The "activity" in that case is simply "I updated field foo". Use case 2 allows things like reason codes, which would be represented as custom fields in the activity itself. Example: I banned this user (set their "ban" field to "true") because "they were naughty". "Naughtiness" would be one of the possible reason codes in a custom field attached to the "ban user" activity type.

I am a user and I think this would be a great module. Has anything happened on this?

Regards,
Amit

Does this still exist?  Can't find it at the svn link... is it now a part of CiviCRM that I'm missing?

 

but can be found here:

 

http://svn.civicrm.org/tools/branches/v3.1/drupal/modules/civicrm_rules/

 

if you do resurrect it and get it back to life, please let us know. might be worth doing it for D7 and Rules2 (which seems significantly different)

 

lobo