Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Error message when you try to integrate accounts in Microsoft Dynamics CRM 3.0 by using the Microsoft Dynamics CRM Connector: "CustomerKey already exists and the UpdateIfExists flag is set to not allow updates"


View products that this article applies to.

Symptoms

You try to integrate multiple accounts in Microsoft Dynamics CRM 3.0 as customers in Microsoft Dynamics GP by using the Microsoft Dynamics CRM Connector for Microsoft Dynamics GP. If the account name of the first account contains 14 alphanumeric characters that are followed by a space character, the first account is integrated successfully. However, successive accounts that have account names that are 14 characters long may not be integrated as expected. Additionally, you receive the following error message:
CustomerKey already exists and the UpdateIfExists flag is set to not allow updates.
If account names that contain 14 alphanumeric characters that are followed by a space character are integrated to Microsoft Dynamics GP, and if you update the first such customer record in Microsoft Dynamics GP, a duplicate account is created in Microsoft Dynamics CRM.

Consider the following scenario:
  • You create an account in Microsoft Dynamics CRM that is named Colorado State University. Notice that this account name cannot exist in Microsoft Dynamics CRM. Additionally, the name must have a blank space as the 15th character in Microsoft Dynamics CRM. For example, you can also create an account in Microsoft Dynamics CRM that is named Nebraska State University.
  • This new record integrates to Microsoft Dynamics GP. The record has a Customer ID value of "Colorado State" and a customer name of Colorado State University. You update the customer record in Microsoft Dynamics GP. For example, you change the e-mail address.
  • You expect this record to integrate to Microsoft Dynamics CRM as an update to the existing record for Colorado State University. However, a duplicate account is instead created in Microsoft Dynamics CRM. The account name for the duplicate record is Colorado State University. The new account now links to the customer in Microsoft Dynamics GP.

↑ Back to the top


Cause

This issue may occur because the Microsoft Dynamics CRM Connector uses the value in the Account Name field in Microsoft Dynamics CRM 3.0 to create the value in the customer number (CUSTNMBR) field in Microsoft Dynamics GP.

By default, the value in the Account Name field in Microsoft Dynamics CRM 3.0 can contain up to 160 characters. In Microsoft Dynamics GP, the value in the CUSTNMBR field can contain only 15 characters. When the value in the CUSTNMBR field is created during the integration process, the space character that follows an account name that is 14 characters long causes a duplicate CUSTNMBR value to be created.

↑ Back to the top


Workaround

To work around this issue, update the Microsoft Dynamics CRM Connector maps on the computer that is running Microsoft BizTalk Server. To do this, follow these steps.

Step 1: Set up the BizTalk Visual Studio Projects for the Microsoft Dynamics CRM Connector

  1. Create a new blank solution in Microsoft Visual Studio. To do this, follow these steps:
    1. Start Microsoft Visual Studio .NET 2003.
    2. On the File menu, click New, and then click Blank Solution.
    3. In the Name box, type IntegrationSolution as the name of the solution, and then click OK.
  2. Copy the SchemaMaps folder from the Microsoft Dynamics CRM Connector installation location to the root folder for the blank solution. To do this, follow these steps:
    1. Locate the installation files for the Microsoft Dynamics CRM Connector.
    2. Right-click the SchemaMaps folder, and then click Copy.
    3. Locate the IntegrationSolution solution. By default, the solution is located in the following folder:
      C:\Documents and Settings\username\My Documents\Visual Studio Projects
    4. Open the IntegrationSolution folder.
    5. Right-click a blank area in the folder, and then click Paste.
  3. Add the three BizTalk projects in the SchemaMaps folder to the blank solution. To do this, follow these steps:
    1. On the View menu, click Solution Explorer.
    2. Right-click the solution in Solution Explorer, click Add, and then click Existing Project.
    3. Open the SchemaMaps folder, and then open the CRMSchemas folder.
    4. Double-click the CRMSchemas.btproj file.
    5. Right-click the solution in Solution Explorer, click Add, and then click Existing Project.
    6. Open the GPSchemas folder.
    7. Double-click the GPSchemas.btproj file.
    8. Right-click the solution in Solution Explorer, click Add, and then click Existing Project.
    9. Open the Mapscrmgp folder.
    10. Double-click the Mapscrmgp.btproj file.
  4. Create a strong name key file to sign the output of each project. To do this, follow these steps:
    1. Click Start, point to All Programs, point to Microsoft Visual Studio .NET 2003, point to Visual Studio .NET Tools, and then click Visual Studio .NET 2003 Command Prompt.
    2. At the command prompt, type the following command, and then press ENTER:
      sn -k the path in which you want the strong name key file to be written\file_name.snk
  5. Set up each project to use the strong name key file to sign the output of each project. To do this, follow these steps in Microsoft Visual Studio for each project in the IntegrationSolution solution:
    1. Right-click the project, and then click Properties.
    2. Under Common Properties, click Assembly.
    3. In the Strong Name area, click False in the Assembly Delay Sign box.
    4. In the Assembly key file box, type the path of the .snk file that you created in step 4.
    5. Click OK.
  6. Add references to the integration .dll files. To do this, follow these steps:
    1. Expand the MapsCRMGP project, expand References, right-click the following references, and then click Remove:
      • Microsoft.MbsIntegration.CRMSchemas
      • Microsoft.MbsIntegration.GPSchemas
      • Microsoft.MbsIntegration.FunctoidsCRMGP
    2. Right-click References, and then click Add Reference.
    3. Click Browse, and then locate the Microsoft.MbsIntegration.FunctoidsCRMGP.dll file.

      By default, the Microsoft.MbsIntegration.FunctoidsCRMGP.dll file is in the same folder as the Microsoft Dynamics CRM Connector installation files.
    4. Click the Microsoft.MbsIntegration.FunctoidsCRMGP.dll file, and then click Open.
    5. Right-click References, and then click Add Reference.
    6. On the Projects tab, select the CRMSchemas project and the GPSchemas project, click Select, and then click OK.
  7. Change the assembly name for the MapsCRMGP project output. To do this, follow these steps:
    1. Right-click the MapsCRMGP project, and then click Properties.
    2. Under Common Properties, click General.
    3. In the Assembly name box, click Microsoft.MbsIntegration.MapsCRMGPCustom, and then click OK.

Step 2: Update the Crm_account_to_gp_customer.btm BizTalk map

In this step, you use a scripting functoid to remove spaces from the value that is mapped to the CUSTNMBR node. The value that is mapped to the CUSTNMBR node is in the Crm_account_to_gp_customer.btm BizTalk map of the MapsCRMGP project in the solution.

To do this, follow these steps:
  1. Expand the MapsCRMGP project.
  2. Expand the AccountCustomer folder.
  3. Double-click the Crm_account_to_gp_customer.btm file.
  4. Under Advanced Functoids in the Microsoft Visual Studio toolbox, drag a scripting functoid to the Mapping area.
  5. On the right side of the mapping file, locate the CUSTNMBR node.
  6. Locate and then select the link that connects the CUSTNMBR node to the scripting function in the map.

    Note When you select the link node, the link node will change to blue.
  7. Click the end of the link that connects the CUSTNMBR node, and then drag that end to the new scripting functoid that you added to the Mapping area.
  8. Click the scripting functoid that you connected by using the link, and then drag the scripting functoid to the CUSTNMBR node.

    You should now have a scripting functoid that is linked to another scripting functoid. Additionally, the scripting functoid should be linked to the CUSTNMBR node.
  9. Right-click the scripting functoid that you added to the Mapping area, and then click Properties.
  10. Click the ellipsis button (...) for the Script property. The Configure Functoid Script dialog box opens.
  11. In the Script type box, click Inline C#.
  12. In the Inline script buffer box, select and then delete the text.
  13. Copy the following code into the Inline script buffer text area, and then click OK.
    public string ReplaceSpaces(string custnmbr)
    {
       custnmbr = custnmbr.Replace(" ","");
       return custnmbr;
    }
    
  14. On the Build menu, click Build MapsCRMGP.

Step 3: Publish the customized Crm_account_to_gp_customer.btm BizTalk map

In this step, you update the Crm_account_to_gp_customer.btm BizTalk map by using the Setting and Administration Tool on the server that is running the Microsoft Dynamics CRM Connector. To do this, follow these steps:
  1. Click Start, point to All Programs, point to Microsoft CRM Connector for Microsoft Dynamics GP, and then click Setting and Administration Tool.
  2. Click Administration, and then click Integration Server.
  3. Click the Customize Maps tab.
  4. Click Add Map.
  5. Locate and then open the Microsoft.MbsIntegration.MapsCRMGPCustom.dll file.
  6. In the Add New Map Web Page dialog box, click Select Map, and then click Microsoft.MbsIntegration.MapsCRMGP.crm_account_to_gp_customer. Then, follow these steps:
    1. In the Map description type box, type a description for the map.
    2. In the Event box, click Create.
    3. In the Source application box, click Microsoft CRM.
    4. In the Source entity box, click Account.
    5. In the Destination application box, click Microsoft Great Plains.
    6. In the Destination entity box, click Customer.
    7. Click Deploy Maps.
  7. Click OK.
  8. Click Start, point to All Programs, point to Administrative Tools, and then click Services.
  9. Restart the following services:
    • BizTalkServerApplication
    • MBSIntSendHost

↑ Back to the top


Keywords: KB929277, kbprb, kbmbsmigrate, kberrmsg, kbexpertiseinter, kbtshoot, kbmbscrm40no

↑ Back to the top

Article Info
Article ID : 929277
Revision : 4
Created on : 8/15/2007
Published on : 8/15/2007
Exists online : False
Views : 337