I have ~500 existing contacts that I need to create user accounts for. Creating the accounts is easy, but when I do, they are not automatically connected to the corresponding contact record.

On the admin/config/crm-core/user-sync page, I have checked "Match existing contacts when creating an account?"

These are all "Individual" contact records, and the "Primary email field" has been set for this contact record type.

For my testing, I am manually creating a user account using an email address of an existing contact record. When it didn't work the first couple of tries, I started copying & pasting the contact's email address to eliminate the possibility of spelling errors...

This seems like it should be very straight forward, which leads me to believe I'm simply failing to do something obvious. Any help will be much appreciated!

Thanks,
Dan

CommentFileSizeAuthor
#6 users_importer.txt1.75 KBRoSk0
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dang42 created an issue. See original summary.

RoSk0’s picture

Status: Active » Closed (works as designed)

You should double check that on admin/config/crm-core/user-sync page you also have created and enabled rule for synchronizing individuals to whatever user role you are creating.
I have tested it on latest code and this feature works as designed.
Feel free to open again if still doesn't work for you.

dang42’s picture

Thanks! It wasn't clear to me I needed to add a rule since I wasn't adding any special role, but that info helps. :)

Or at least it does when I manually create an account...

However, I am creating accounts via feeds, and while the newly created accounts ARE connected to contacts, they are NEW contacts. I.e. NOT the existing contact.

I tried disabling the automatic user sync, creating a new account via feeds, enabling the user sync and clicking the "Synchronize users" button - same result. The new account gets connected to a NEW contact.

Any thoughts?

Dan

RoSk0’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Component: Documentation » Code
Status: Closed (works as designed) » Active

And you are totally sure that new users created by Feeds have the same emails as existing contacts in the configured primary email field?

I'm not very familiar with Feeds, but I will try to reproduce this issue with Feeds import.

dang42’s picture

Yes, the emails are identical.

I created a view of all contacts w/the relevant fields, then exported the data using views data export to a csv that is the source of the import for new users. Since I didn't modify any emails records in the csv, they are indeed the same.

FYI - I found a workaround for this. Since the sync between user & contact is just a relation, and there's a "Relation Feeds" submodule for the Relation module, I can create all the connections this way by:

- Export all contacts, including the contact ID, to csv
- Create user accounts via feeds using this contact info
- Export all user accounts, including the user ID, to csv
- Manually create a 3rd csv that includes the contact ID from the first & the user ID from the second, and use that as the import source for the relations.

I did a test run of 5 contacts & users and it worked as expected. It is a bit of a pain to manually ensure all the user & contact records are lined up (getting the right contact ID on the same line as the correct user ID), but it is A LOT easier than using the user sync UI to manually connect them all.

Since there is a workaround, this is definitely not a high priority. But it would still be easiest - and I'd love to be able to use, if possible - the built-in user sync if we can figure out what the issue is or what I'm doing wrong.

Thanks for continuing to follow up on this. I appreciate it!

Dan

RoSk0’s picture

Status: Active » Closed (works as designed)
FileSize
1.75 KB

I have just tested imported with attached importer and it works perfectly fine and match new user to existing contact.

No sure about your use case, but if you have your contacts locally and need to create users for them and link them together you should just right that up in code in hook_update() for custom module.

dang42’s picture

Thanks for all your help!

Dan