title: mscrm import update columnmapping reference attribute
body: <p>I work on Dynamics 365 and I need to develop a dynamics update of records using the Import Entity.</p>
  
  <p>I manage to make a dynamics import to create record into Dynamics 365 but for update I have that message : 
  "This attribute is not mapped as a reference attribute. However, you have included a ReferenceMap for it.  Fix this inconsistency, and then import this data map again."</p>
  
  <p>Well, I don't find any documentation even in SDK even on web even on Microsoft website. I hope to find help from you guys ;)</p>
  
  <p>See my code about columnmapping of my reference ID mapping :</p>
  
  <pre><code>Entity colMapping = new Entity(CrmColumnmapping.EntityLogicalName);
  colMapping.Attributes.Add(CrmColumnmapping.Fields.SourceAttributeName, dc.Caption);
  colMapping.Attributes.Add(CrmColumnmapping.Fields.SourceEntityName, "MySource");
  colMapping.Attributes.Add(CrmColumnmapping.Fields.TargetAttributeName, dc.ColumnName);
  colMapping.Attributes.Add(CrmColumnmapping.Fields.TargetEntityName, dt.TableName);
  colMapping.Attributes.Add(CrmColumnmapping.Lookups.ImportMapId, new EntityReference(CrmImportmap.EntityLogicalName, importMap.Id));
  colMapping.Attributes.Add(CrmColumnmapping.OptionSets.ProcessCode, new OptionSetValue(CrmColumnmapping.OptionSets.ProcessCodeValues.Option1_Process));
  colMapping.Id = service.Create(colMapping);
  
  Entity parentLookupMapping = new Entity(CrmLookupmapping.EntityLogicalName);
  parentLookupMapping.Attributes.Add(CrmLookupmapping.Lookups.ColumnMappingId, colMapping.ToEntityReference());
  parentLookupMapping.Attributes.Add(CrmLookupmapping.OptionSets.ProcessCode, new OptionSetValue(CrmLookupmapping.OptionSets.ProcessCodeValues.Option1_Process));
  parentLookupMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpAttributeName, dc.Namespace + "id");
  parentLookupMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpEntityName, dc.Namespace);
  parentLookupMapping.Attributes.Add(CrmLookupmapping.OptionSets.LookUpSourceCode, new OptionSetValue(CrmLookupmapping.OptionSets.LookUpSourceCodeValues.Option2_System));
  parentLookupMapping.Id = service.Create(parentLookupMapping);
  
  Entity currentLookUpMapping = new Entity(CrmLookupmapping.EntityLogicalName);
  currentLookUpMapping.Attributes.Add(CrmLookupmapping.Lookups.ColumnMappingId, colMapping.ToEntityReference());
  currentLookUpMapping.Attributes.Add(CrmLookupmapping.OptionSets.ProcessCode, new OptionSetValue(CrmLookupmapping.OptionSets.ProcessCodeValues.Option1_Process));
  currentLookUpMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpAttributeName, dc.ColumnName);
  currentLookUpMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpEntityName, dt.TableName);
  currentLookUpMapping.Attributes.Add(CrmLookupmapping.OptionSets.LookUpSourceCode, new OptionSetValue(CrmLookupmapping.OptionSets.LookUpSourceCodeValues.Option1_Source));
  currentLookUpMapping.Id = service.Create(currentLookUpMapping);
  </code></pre>
  
  <p>See my code about import :</p>
  
  <pre><code>Entity import = new Entity(CrmImport.EntityLogicalName);
  import.Attributes.Add(CrmImport.OptionSets.ModeCode, new OptionSetValue(CrmImport.OptionSets.ModeCodeValues.Option2_Update));
  import.Attributes.Add(CrmImport.Fields.Name, "UpdateImport");
  import.Id = service.Create(import);
  </code></pre>
  
  <p>If someone know how to map the reference attribute (ex : systemuserid) to manage to make a dynamics update import, it will be appreciated.</p>
  
  <p>Thanks a lot</p>