次の方法で共有


Dynamics CRM 2013 Import org fails because of duplicate user names

This details about a scenario in Dynamics CRM 2013 with an import of an organisation failing due to duplicate user names.

 

Environmental pre-condition:

There are at least two trusted Domains (e.g. Domain1 and Domain2). Once in a while it may become necessary that a user is moved into a new Domain (e.g. for a new Job). In this case the user domain1\username is disabled in domain1 and created as domain2\username in domain2. Please note that both times the very same username is taken for that user. As a consequence, the same will be done in CRM: domain1\username will be disabled and a new user domain2\username will be enabled.

You would import the org with these two duplicate usernames (one is disabled) and log on to CRM 2013 after this Import

Result

The users are unable to log on to CRM.

These error messages are thrown:

Error message 1: "Business Management Error" "The user ID associated with the current record is not valid".

Error message 2: "No Microsoft Dynamics CRM user exists with the specified domain name and user ID".

In the import log you may find these warnings:

Warning| The following mappings were not valid because these crm users are mapped to AD users that are mapped multiple times: (Domain1\username, Domain2\username),

Cause

When CRM maps the user to AD user, the disabled user will show up before the active user in the list most of the times. When that occurs, we will always map to the disabled user instead of the active user.

When CRM moves on to the next mapping, which is the Domain2\username,  this fails because AD account Domain2\username is already mapped to the disabled CRM user account that was previously mapped to Domain1\username, and we cannot have a valid AD account mapped to multiple CRM users in one organization.

This is working as design as this part of the code is also used elsewhere.

Resolution

1) Do not create a separate new CRM user but remap the AD Account of existing user

You may correct the problem also later on in this way:

1. Create two dummy users in AD: domain2\Dummy1 and domain2\Dummy2

2. Map active CRM user Testuser to dummy domain2\Dummy1

3. Enable the disabled user entry in CRM

4. Map this CRM user to domain2\Dummy2

5. Disable this user again

6. Map the active CRM user (beneath 2) back to the “real” ADUser”

 

2)   The best option is to create a mapping file and maintain that file for this and any other affected organizations. You can get a good start on the mapping file simply by selecting the records from the SystemUserBase table and then altering the results as needed. This will ensure definitive mapping for the user accounts. Also, once the mapping file is created, using it during the import process is nearly as simple as using Automatic Mapping.

More Information

Note: Always ensure you have a recent backup of the CRM database before any changes in SQL.

 

In order to create a mapping file via SQL select from System user base, you may go through these steps:

1. Create and Copy the XML file to the CRM Server that you will be importing the Organization from:

<MappingConfiguration>

<DomainMapping old="" new="" />
</MappingConfiguration>

2. Open the XML file and update the line <DomainMapping old="" new="" /> so that the old and new values are correctly populated for the NETBIOS domain names.

3. Run the following script against the SystemUserBase table in the ORG_MSCRM database. This will select all active users.

DECLARE @d varchar(20)

-- @d variable should be updated to reflect the new domain name.

SET @d = 'NewDomainName'

Select '<UserMapping old="' + DomainName + '" ' + 'new="' + @d + substring([DomainName], PatIndex('%[\]%', [DomainName]), len([DomainName])) + '" />' from [SystemUserBase] where IsDisabled = 0

4. Copy all of the results and paste into the UserMappingFileBase.xml file in between the MappingConfiguration tags.

5. Save the XML file and use it during the Import Org process.

 

Best Regards

EMEA Dynamics CRM Support Team

Share this Blog Article on Twitter

Tweet

Follow Us on Twitter

Follow @MSDynCRMSupport