Create Data Maps for Import
To import data into Microsoft Dynamics CRM, you must provide the appropriate data maps.
The examples of the data maps can be found in this location in the SDK download:
You use data maps to map the data contained in the source file to the Microsoft Dynamics CRM entity attributes. You must map every column in the source file to an appropriate attribute. The data in the unmapped columns is not imported during the data import operation.
The data map is represented by the import map (data map) entity. You can create a new map by using the CreateRequest message or update an existing map by using the IOrganizationService.Update method. The map has a unique name that is contained in the ImportMap.Name attribute. You can specify the name of the import source for which this data map is created by using the ImportMap.Source attribute.
In This Topic
Column, List Value and Lookup Mappings
To map a column, a list value or lookup value in the source file to a Microsoft Dynamics CRM attribute, use the following mappings.
Maps a column in a source file to a Microsoft Dynamics CRM entity attribute. For column mapping, use the column mapping (ColumnMapping) entity. You can use 1:1 (one-to-one) or 1:N (one-to-many) relationships between source and target attributes. For example, you can map account address information to the billing and shipping addresses in an order.
List Value Mapping
Maps a list value in a source file to a Microsoft Dynamics CRM attribute of the OptionSetValue type. For list value mapping, use the picklist mapping (PicklistMapping) entity.
If a value specified in the source file column is a list value, such as an OptionSetValue, Status, State, and Boolean, you must provide a list value mapping additionally to a column mapping. For example, map the "bill" and "ship" list values in the source file to the bill and ship values of the OptionSetValue type.
Maps a lookup value in a source file to a Microsoft Dynamics CRM attribute of the EntityReference type. For lookup mapping, use the lookup mapping (LookupMapping) entity.
If the value specified in the source file references an entity, you must provide a lookup mapping for this value. Use the LookupMapping.LookupSourceCode attribute to specify whether to search for the referenced entity inside the source file or inside Microsoft Dynamics CRM. If you are using early bound types, you can use the LookupSourceType enumeration to set the lookup values. To search inside the source file, use the LookupSourceType.Source value. To search inside Microsoft Dynamics CRM, use the LookupSourceType.System value. For a list of the LookupSourceCode values, see LookupMapping Entity OptionSet Attribute Metadata. You can provide multiple lookup mappings. The asynchronous transformation job processes all available mappings. It finds the referenced records and updates the parse table with the record unique identifiers. For more information, see Run Data Import.
Use owner mapping to map a user specified in the source file to a user in Microsoft Dynamics CRM. For logging information, use the Microsoft Dynamics CRM user logon name. For owner mapping, use the owner mapping (OwnerMapping) entity.
Notes and Attachments
Mapping for notes and attachments is handled differently from other entities. Notes and attachments are used to append additional information to a record in Microsoft Dynamics CRM. Notes are stored as text and attachments are stored as files in the Microsoft Dynamics CRM database.
To create a note in Microsoft Dynamics CRM, set the Annotation.IsDocument attribute in the annotation (note) entity to false. To create an attachment, set IsDocument to true.
Use the following settings for mapping notes and attachments:
Set the ColumnMapping.SourceAttributeName attribute to true or false. The true value indicates an attachment. The false value indicates a note.
Set the ColumnMapping.TargetAttributeName attribute to IsDocument.
Set the ColumnMapping.ProcessCode attribute to the ImportProcessCode.Internal value of the ImportProcessCode enumeration, if you are using early bound types. For a list of the ProcessCode values, see ColumnMapping Entity OptionSet Attribute Metadata.
If the source data represents a note, map the text of the note to the Annotation.NoteText attribute. If you are working with Salesforce files, they are usually stored on the disk under unique identification numbers. To import an attachment, you must map a file identification number that is contained in the source file to the Annotation.DocumentBody attribute. The DocumentBody attribute stores the contents of the attachment.
The import asynchronous job checks for mappings that have the source attribute name set to true and false to discover notes and attachments. If it finds an attachment mapping, it looks for the specified files on the disk and uploads the file contents as attachments into Microsoft Dynamics CRM. If a file is not found, an error is returned.
If you do not provide mapping for an annotation (note) entity, the import job generates a default mapping for the note.
|The maximum size of files that can be uploaded is determined by the Organization.MaxUploadFileSize property. This property is set in the E-mail tab of the System Settings in the application. This setting limits the size of files that can be attached to email messages, notes, and web resources. The default setting is 5 MB. However, an attachment size cannot exceed the maximum HTTP request size (the default is 16MB). For the change to take effect, reset Internet Information Services (IIS). To do this, click Start, click Run, type iisreset, and then click OK.|
Import and Export Data Maps
You can export an existing data map to an XML file and import XML data mappings into Microsoft Dynamics CRM. To export a data map from Microsoft Dynamics CRM, use the ExportMappingsImportMapRequest message. To import XML data mappings and create a data map in Microsoft Dynamics CRM, use the ImportMappingsImportMapRequest message.
Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.