Configure data import

The configuration information that is required for importing data is contained in the data import (Import) entity and the import source file (ImportFile) entity.

To configure data import, do the following:

  • Use the Import.ModeCode attribute to specify whether to create or update data during import. If you are using early bound types, you can use the ImportModeCode enumeration. For a list of the ModeCode values, see the picklist values for this entity. To view the entity metadata for your organization, install the Metadata Browser solution described in Browse the metadata for your organization. You can also browse the reference documentation for entities in the Entity Reference.

  • Use the ImportFile.FileTypeCode attribute to specify the type of the import file. If you are using early bound types, you can use the ImportFileType enumeration. For a list of the FileTypeCode values, see the picklist values for this entity.

  • Use the ImportFile.DataDelimiterCode attribute to specify the single character data delimiter in the import file. If you are using early bound types, you can use the ImportDataDelimiter enumeration. For a list of the ImportDataDelimiter values, see the picklist values for this entity.

  • Use the ImportFile.FieldDelimiterCode attribute to specify the single character field delimiter in the import file. If you are using early bound types, you can use the ImportFieldDelimiter enumeration. For a list of the FieldDelimiterCode values, see the picklist values for this entity.

  • Set ImportFile.IsFirstRowHeader to true to indicate that the first row in the source file contains column headings or to false to indicate that the first row contains actual data. If set to false, default column headings are generated.

  • Set ImportFile.ImportId to the ID of the import (data import) that the import file is associated with.

  • Set ImportFile.ImportMapId to the ID of the associated import map (data map).

  • Set ImportFile.EnableDuplicateDetection to true to enable duplicate detection during data import.

  • Read the content of the source file into the ImportFile.Content.

Important

We do not recommend updating records by using data import programmatically. To update, use the data export and import capabilities of the Common Data Service Web application. Use Export to Excel to export records to an XML Spreadsheet 2003 (.xml) file. This is the only valid source file type for the Update mode. Re-importing data from the XML Spreadsheet 2003 (.xml) source file ensures that the data integrity in Common Data Service is maintained. To import updated data, use the Common Data Service Import Data Wizard. For more information about the Import Data Wizard, see Common Data Service Help.

See Also

Import data
Blog Post: How to Import attachments programmatically
Prepare source files for import
Create data maps for import
Add transformation mappings for import
Run data import
Data import entities
Sample: Export and import a data map
Sample: Import data using complex data map