0

I'm wanting to upgrade a current site to use the RedHen CRM module to track contact engagement (etc.) but first need to create RedHen contacts (redhen_contact module) for each of the users. I'm familiar with Drush scripts so would be fine writing up a script but I'm unfamiliar with the internals of how RedHen works in Drupal. Is there anybody who knows it already who might be able to help point the way?

Note: This is not a third-party api. It's a CRM built within Drupal as a Drupal module. What I'm asking is the proper form to utilize the Entity API to create contacts within the RedHen CRM module programmatically.

  • How many users? Might be able to do it with Batch API. – Kevin Sep 24 '16 at 2:33
  • 1
    Welcome to Drupal Answers :) This site is just for questions about Drupal, questions about unrelated 3rd party APIs will need to be asked somewhere else – Clive Sep 24 '16 at 11:09
  • @Clive: It's not a third-party api. It's a CRM built within Drupal as a Drupal module. What I'm asking is the proper form to utilize the Entity API to create contacts within the RedHen CRM module programmatically. Does that make sense? – reor Sep 26 '16 at 16:42
  • There are many ways of doing this... bottom line is you could use Rules and trigger on user create or user update and fire a custom action, or create a module and do it on entity insert/update of type user. Then employ the RedHen Contact API, view its source for an example. – Kevin Sep 26 '16 at 17:18
  • @Kevin: Thank you for your input. RedHen does automatically create and synchronize contacts when users are created and data is updated. Hmm... perhaps that's a method I could use to 'auto-generate' the contacts without needing to set all of the contact entities' fields myself. Will explore. – reor Sep 26 '16 at 19:47
1

Rules might be the quickest way to achieve this.

You could have one that on user create, generate a new contact for that user, and a separate rule that after a user updates their information update their contact.

enter image description here

According to RedHen documentation, they have direct rules support so this seems like an easy addition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.