Recently, we published a post on our global CRM Blog that talks about a feature in Microsoft Dynamics CRM 2011 through which you can Import data from a single source file into multiple entities.

Importing two or more entities from a Single File

http://blogs.msdn.com/b/crm/archive/2010/11/04/importing-two-or-more-entities-from-a-single-file.aspx

The example in the Blog post and out of the box is only if you have a single CSV file that has data that you want to split across the Contact and Account entities.

clip_image002

But, and if we want to do it for other entities (including custom entities)?

Let’s see how we can do it:

I created this Excel file with data from two entities (Contact and a custom entity called Soup):

image

Then, using Visual Studio as XML editor, created this Multi-Mapping test file, where I refer both entities and “Multiple” as EntitiesPerFile:

<Map Name="Multi-Mapping Test" Source="Import">

       <Description>Multi-Mapping file created by me</Description>

       <EntitiesPerFile>Multiple</EntitiesPerFile>

       <EntityMaps>

             <EntityMap TargetEntityName="contact" SourceEntityName="Contact" Dedupe="Ignore" ProcessCode="Process">

             </EntityMap>

             <EntityMap TargetEntityName="new_soup" SourceEntityName="province" Dedupe="Eliminate" ProcessCode="Process">

             </EntityMap>

       </EntityMaps>

</Map>

Having the data and the template, let’s test it:

First, we need to import the template:

clip_image004

clip_image006

Note:

If any or both entities are custom entities, they must be present in the system by this time.

clip_image008

Once imported the Multi-Mapping file, we can go to Imports and select our data file (that contains data from multiple entities):

clip_image010

And once it is uploaded, we will choose our Custom Data Mapping:

clip_image012

Using our custom mapping file, we are now able to map the data for both entities at once:

clip_image014

clip_image016

clip_image018

Best Regards,

Dynamics CRM Team