Thursday 14 December 2017

How to Import N:N relationship records in MS Dynamics CRM/365








Recently, I came across a scenario where I was expected to import a set of records in CRM which has related records,and  the relationship being a N:N.
I was just given an Excel file and there is no option to import related records out of the box(at least when this post was written).
So after spending a couple of hours, I found an easy way to do this.

Step 1: Import the records of the related entity as usual(using OOTB import feature). Now we have to figure out a way to just associate the records of these two entities.
For this example, lets assume I want to import records of Account and Product which are related with  a N:N.

Step 2: Import Accounts separately. Import Products separately via OOTB import feature.

Step 3: Now, download XRMToolBox.

Step 4: Make use of the N:N data


Step 5: Connect to the desired organization. Click on Load Metadata button.


Step 6:Select the Account Entity under First Entity option and the relationship name(N:N) . Select which attribute you want the app to find out for a particular account. For eg, Account Number or Account name etc.

Step 7: Select the corresponding relationship name.

Step 8: Select the Product Entity against Second Entity and the field name for identifying a Product record. Say Product ID.

Step 9: Now, select the csv file with only two columns. First Column should contain Account Id and the second column should contain contact id.
Ensure you dont add headers to this csv file.

Click on Import  and you can see the status of each line in the log.