We all know that while importing data from a CSV file using the Import Data feature of Dynamics CRM 2013 we can define which field in a related entity we wanted to use for resolving Lookup fields. The Define lookup mapping during import describes this and a blog post CRM 2013: How To Set A Lookup Value With Non-Primary Field As Reference When Importing Csv Data? cleanly outlines the steps to get this done.
Recently I was doing data import for one of my client. The Contact entity has a numeric (Whole Number) ID field and has a 1: N relationship with another custom entity (Address). Now client wanted to upload a CSV file with Address records having the column for Contact ID (not the Contact Name as there could be two contact’s having same name).
Below is a sample import file:
Now when started our Data Import with CRM 2013’s native Import data feature and mapped the “Contact ID” column of the CSV file to the numeric ID field of the Contact entity.
We thought as Contact IDs cannot be duplicated in the system (because they are auto-numbers), the import process would create Address records and then link them to correct contact records. But to our surprise the import failed!
Then we converted the ID field in the Contact entity to a Text field (Single Line of Text). Then re-tried the same import with the same mappings. The import was successful. Address records are created and linked to the correct Contact records.