In Microsoft Dynamics 365/CRM, there may be times when you need to import child records in a one-to-many (1:N) relationship which include a relationship to a parent record, but instead of having access to the Primary Field used by D365/CRM for the parent record, you have access to some other identifier such as an Account Number or ID. The example I’ll provide works when importing child records with a parent association. The Primary Field in D365/CRM is not available, but a different distinct parent identifier is available.
First things first, we need to understand what D365/CRM uses for the Primary Field for the import, as the import will try to resolve against this for the parent entity. For this, we will be looking at the relationship between an Account, and its related Contacts. From a Contact record, this relationship is established by the Account Name field. In the screenshot below, you can see how this 1:N relationship between an Account and its Contacts are made:
The data displayed in the Account Name field on the Contact is coming from the corresponding Primary Field for the Account, which is the Account Name field. To determine what data is expected from the system for this, open a solution containing this information, it may be easiest to use the default solution. Select the entity representing the parent record, in this case, Account. Next, select the Primary Field tab. This tab displays the field the import process will try to resolve against.
Using this information, if we have an Account with Account Name: ACME, when we try to import Contact records, and make an associated to an Account, the import process expects ACME to be in the Contact file for Company Name field.
When this Account Name is not available, and instead you have some other Account Number or ID, such as ACME001. With this distinct value, in both our Contact file, and already existing on the Account record, we can still successfully import the Contacts with this Account relationship, we just need to go through some extra steps.
For this, we have ACME set-up as an account, with their Account Number/ID: ACME001 stored in the Account Number field. Our Contact file contains the following data:
Company Name First Name Last Name
ACME001 Mike Smith
Step 01: To import this data, navigate to: Settings > Data Management > Imports, and click the Import Data button.
Step 02: On the Upload Data File window, select your Contact file and click Next. On the Review File Upload Summary window, make any adjustments and click the Next button.
Step 03: On the Select Data Map window, map an appropriate selection, I usually use System Data Maps – Default (Automatic Mapping). Make an appropriate select and click the Next button.
Step 04: On the Map Record Type, select the appropriate record. In our scenario, this would be Contact. Make an appropriate select and click the Next button.
Step 05: This is where we depart from the normal process. On the Map Fields window, we need to take a step to map our Account ID (in the Company Name field in our file) to the corresponding Account field: Account Number. For this, click the icon adjacent to the drop down for the standard mapping:
On Account, use the look-up to open the Select Fields window. Unselect all fields, and then select your Account Number/ID field, in our case: Account Number. With this selected, click OK to return to the previous window. Click OK to close. Back on the Map Fields window, click the Next button.
Step 06: Proceed through the rest of the import wizard windows.
Below, you can see our successfully imported Contact, with the Account relationship:
While the walkthrough was for a Contact, and the association to Account, this same methodology can be extended to other scenarios in the system.
Note: While the D365/CRM import tool is incredibly easy to use, always secure a back-up of your data prior to importing.