Closed (fixed)
Project:
RedHen CRM
Version:
7.x-1.x-dev
Component:
redhen_contact
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Sep 2012 at 23:31 UTC
Updated:
31 Oct 2012 at 18:01 UTC
I have been playing around with manipulating RedHen entities with rules. It seems like a couple of custom rules actions would help make pretty much every aspect of RedHen configurable with Rules.
This patch is a start. It gives you the ability to fetch the Redhen Contact from an account. More actions to come...
| Comment | File | Size | Author |
|---|---|---|---|
| 00-redhen_contact_addtional_rules_actions.patch | 1.52 KB | jlyon |
Comments
Comment #1
tauno commentedWould it make more sense for us to alter the user entity to add a 'contact' property with a getter callback that grabs the active contact for the user? Might help with modules other than rules as well.
Comment #2
nedjo@tauno: while that could be useful, it won't cover all cases, as many contacts won't have corresponding user accounts.
@jlyon: thanks for the start! Some of what's needed could be modelled on the rules integration in redhen_engagement. What we're doing will in many cases be similar: responding to an action - e.g., anonymous login - that includes an email address that can therefore be related to or converted into a contact. Probably we should look first at generalizing what's in redhen_engagement.rules.inc. For example, the function
redhen_engagement_rules_action_find_by_mail()should probably be moved into redhen_contact and renamedredhen_contact_load_by_mail().Comment #3
nedjoI guess actually the first step is to identify what Rules integration we want that isn't covered by default entity rules integration, or won't be once #1741568: Rules entity creation fails when creating RedHen Contact and any followup is completed.
Here are some suggestions of what we'll want:
Events
Conditions
Actions
Comment #4
nedjoRefreshed a relevant Rules patch: #1777204: Add condition "Entity exists by property".
Comment #5
jlyon commented@nedjo: That list looks good. I would like to add one action: Create redhen_contact. The generic rules create entity doesn't let you select a bundle so is kind of useless for creating new contacts.
Comment #6
nedjo@jlyon: Yes, creating a contact is one of the key missing pieces. That said, I think it's what #1741568: Rules entity creation fails when creating RedHen Contact is aiming at, so we shouldn't have to write a custom rules action for this. Looks like there's a new branch in #1741568 that can needs testing.
Comment #7
tauno commentedThe entity-metadata branch has been merged into 7.x-1.x now. Let us know if there are other properties you need in rules that don't work yet.
Another event that could be useful is when the contact - user linkage is updated. Not sure if it helps, but there's a hook for that (hook_redhen_contact_user_update).
We're not using rules heavily in our current RedHen projects, so it's great to see work being done on this.
Comment #8
levelos commentedDue to lack of activity, I'll assume this was fixed with the entity metadata changes. Feel free to reopen if not.