Salesforce Platform Developer I Certification Guide
上QQ阅读APP看书,第一时间看更新

Importing data

You can easily import data from external sources into Salesforce as long as the external source can provide you with a comma-separated values format (.csv).

Salesforce supports two main methods for importing data:

  • Data Import Wizard: This is an in-browser wizard that is accessible through the Setup menu. It lets you import data in your account, contacts, leads, campaign members, solution-standard objects, and in custom objects. It's a very simple interface that lets you import up to 50,000 records at a time. It can detect and avoid duplicates while importing and it's also possible to deactivate all workflow rules while doing the import. The following screenshot shows the interface of the Data Import Wizard in Salesforce:
  • Data Loader: This is a client application that is downloaded onto your local PC and allows access to your org using the Salesforce API. The latest version of Salesforce Data Loader can be downloaded from the Setup menu, under Integrations. There is a copy for Windows and macOS. Data Loader lets you import data into any object. You can use the Data Loader through its application's UI or through the command line (this makes it possible to automate import and export processes through scripts). It can import up to 5 million records at a time, but cannot detect or avoid duplicates, and there is no setting to deactivate the workflow rules while importing. If necessary, you can first deactivate the workflow rules manually in Salesforce before running the import through Data Loader and, afterwards, the successful import will reactivate them manually:

Data Import Wizard can be used in the following situations:

  • When the number of records to load are less than 50,000
  • When the data needs to be imported into custom objects or into some of the following standard objects—Account, Contact, Lead, Campaign Member, or Solution
  • When the import process does not have to be automated

Data Loader can be used in the following situations:

  • When the number of records to load exceeds 50,000 records, or you need to import up to 5 million records
  • When the data needs to be loaded into an object that isn't supported by the Data Import Wizard, such as Case, Task, Opportunity, and Event
  • If you want to set up an automated import process, such as daily nightly imports

The following table shows the difference between Data Import Wizard and Data Loader:

 

Some worthwhile notes on loading data are as follows:

  • Field accessibility: You can only load data into fields and objects for which you have read and edit access from your profile.
  • New values for picklists and multi-select picklists: When importing a value that does not exist as picklist value in Salesforce, follow these guidelines:
    • If it's an unrestricted picklist field, the Data Import Wizard and Data Loader will use the value from your import file
    • If it's a restricted picklist field, the Data Import Wizard uses the picklist's default value and the Data Loader will give an error message
  • Multi-select picklists: To populate a multi-select picklist with multiple values, those values must be in one cell and separated by a semicolon. Only 100 values can be populated in a multi-select picklist field at a time through an import.
  • Checkboxes: For checkboxes, you can use TRUE, FALSE, or 1 for checked values and 0 for unchecked values.
  • Default values: For picklist, multi-select picklist, and checkbox fields, if your import file does not have such fields mapped and in Salesforce, a default value is defined and it will be populated with its default value.
  • Date/time fields: Make sure the format of any date/time fields you are importing matches the format of your locale setting in Salesforce.
  • Formula fields: These are read-only and cannot be imported.
  • Field validation rules: These are evaluated before records are imported. If a record fails a validation, then that record will not be imported. If necessary, you could deactivate validation rules prior to the manual import.
  • Geolocation custom fields: You must supply two values: a latitude and a longitude, separated by a semicolon.
  • Currency fields: As with date/time, currency values must be in the same currency format as your local settings in Salesforce.