Sep 11, 2013

Microsoft CRM 2011, import CSV file with entity references (lookups)

While most of the time you probably could use a LookupMaps to set up an entity references in you import maps, you may come to situation there you want put actual ID's (references) in your CSV file. So, the tricky part here is the format. To create EntityReference you need entity type name and it's GUID. How would you put that into CSV string? The answer is like this:

"entity_type_name,{SOMEGUID-3FBA-47E5-ADD0-F6078ACDABB8}"

Note that surrounding quotes are required, because of the comma.

2 comments:

  1. Unfortunately, this does not work in CRM 2011. Instead, you have 2 options:
    (1) you need to provide the display value associated with the lookup. If the display value is not unique, the import will fail.
    (2) you provide the GUID without the 'entity_type_name'. During the import, when you map the lookup field, do not map to the name field. Instead, use the lookup icon, to map to the primary key field. Have a look at this post
    http://exploringxrm.wordpress.com/2012/05/08/resolving-duplicate-lookup-references-in-import-process/

    ReplyDelete
    Replies
    1. This works (at least worked not so long ago) in CRM 2011, since I've used it personally.

      Delete