I've found crm_core_user_sync module, which is great for creating a contact from a user.
What I really need is the inverse: when a new Contact is created, specifically via CRM Core Donation, link to an existing user or create a new one.

What's the best way to do this?

Comments

Anonymous’s picture

Right now, there is no simple process for creating user accounts from contacts. There is CRM Core User Sync, which will create contact records when people create user accounts.

I am considering adding a feature to user sync that lets you create accounts from contacts. Would that be helpful? It's actually not too hard.

AaronBauman’s picture

Category: Support request » Feature request

Yeah, that is basically what I'm after.
I thought about doing it with rules, similar to the way the Commerce anonymous checkout rules work.

dang42’s picture

+1 on this functionality.

This is necessary for moving a contact database into a new site for the first time. It is easy enough to add a bunch of contacts, either manually or via feeds. However, if there is no automated way to create a Drupal user matched to those contacts, and there isn't an automated way for that contact to create a new Drupal account that will sync up with their contact record, then it is up to an admin to do the matching manually. That is not something the users of the sites I build are going to be willing to do, nor will they be willing to pay me to do so (non-profits, small budgets).

Automating this will be extremely helpful to me, and I've got to assume I'm not the only one.

While I have every intention of learning the coding skills necessary to do this myself at some point, I can't do it now. If it really is "not too hard" as you say, then I think it would be a much appreciated addition to the excellent product you guys have created - at least for those of us site builders who haven't yet learned to code.

@aaronbauman - did you figure out how to do this with rules? That was my first thought as well once I figured out there isn't a built-in solution. If you did this successfully w/rules (or any other alternate solution), some pointers would be very helpful!

DuneBL’s picture

I would also enjoy to have this feature.
Here is the use case:
1-Contacts (in fact prospects) are added by the sales team
2-If/when a prospect becomes a customer, I would love to have some kind of button to convert this contact/prospect into a drupal user.

More specifically, this new user should have a special role assigned to him (ex: customer) and all the fields/values created/filled for him in the contact form should migrate into his new user profile.

The purpose of this change is to create, in the website, a private area for him allowing him to change/add/view his personal data.

Any change made in the user profile must be reflected in the contact entity and vice-versa.

Do you think it is something doable (easily) with crm_core?
By the way, I had some time to test those modules and this is a great job... Could you confirm that you will continue to work on it? I am asking because this is the best foundation (for crm) I could find in drupal, but I feel that the progress is just below the minimum requirement to becomes a widespread solution.

Thanks for your dedication

nattyweb’s picture

I have a very similar requirement as #4. I don't need changes in the contact entity to be reflected in the user profile as I'll not have any data stored in both - eg name, email stored only in user profile.

Specifically, a feature as simple as a button to create a new user from an (approved) CRM core contact would be brilliant.

raprieto’s picture

+1

diriy’s picture

subscribed. need this functionality also

diriy’s picture

and also it will be useful to provide proper integration with drupal commerce (even kickstart distributive).
I mean e.g to grant the ability to add CRM Core Profile's information as a Billing or Shipping commerce's information. it will be a powerfull addon

edvanleeuwen’s picture

+1

edvanleeuwen’s picture

I have been able to do this with Rules. In my situation, I have an email address and a name field in which given, middle, family components are stored. From this, I create a a user name. Then I create the user. Users are blocked, so you have to unblock them.

  • Create a rule
  • Add event: After saving new crm core contact
  • Add condition: Entity has field: data selector: crm-core-contact; field contact_name
  • (If neccesary: validate fields, e.g.: Add condition: not and data value is empty [crm-core-contact:contact-name:given])
  • Add action: Create a new entity: value; user; name: [crm-core-contact:contact-name:given].[crm-core-contact:contact-name:middle][crm-core-contact:contact-name:family]; email: [crm-core-contact:field-pers-e-mail]; variable: [entity-created]
  • Add action: Unblock a user: parameter [entity-created]

Import or create users.

Export:

{ "rules_sync_contacten_met_gebruikers" : {
    "LABEL" : "Sync contacten met gebruikers",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "entity" ],
    "ON" : { "crm_core_contact_insert" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "crm-core-contact" ], "field" : "contact_name" } },
      { "NOT AND" : [
          { "data_is_empty" : { "data" : [ "crm-core-contact:contact-name:given" ] } }
        ]
      }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "user",
            "param_name" : "[crm-core-contact:contact-name:given].[crm-core-contact:contact-name:middle][crm-core-contact:contact-name:family]",
            "param_mail" : "[crm-core-contact:field-pers-e-mail]"
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Entiteit aangemaakt" } }
        }
      },
      { "user_unblock" : { "account" : [ "entity-created" ] } }
    ]
  }
}
edvanleeuwen’s picture

Status: Active » Needs review
RoSk0’s picture

Status: Needs review » Active
mazze’s picture

@edvanleeuwen thank yous so much for the rule... you made my day:-)

RoSk0’s picture

Status: Active » Closed (outdated)