Posted by Jim Miller, Senior Consultant
When you are trying to move a lot of data into or out of your Salesforce instance, Data Loader is a good tool to know and have ready in your tool box. Data Loader is a desktop tool that you can download for free from within your Salesforce Setup.
It allows you to Create, Update, Upsert, Delete or Export data via an easy-to-use straight-forward wizard that walks through each of these operations. While you can also use Data Loader for Bulk API, I won’t address that usage in this article.
While Create, Update, Delete and Export are fairly straight-forward operations, Upsert is unique and deserves a brief description. The word “Upsert” comes from the fact that this feature either Updates a record or Inserts a record. Based on either the Salesforce ID or and external ID, Data Loader will update records that it is able to find and create new records for IDs that do not exist. The Success file indicates which records were updated and which records were created allowing you to double-check your work.
The Data Loader wizards have a graphical user interface that makes it easy to use. After logging into Data Loader you will be asked to select the Salesforce object you are uploading data into and the CSV file for your action.
Data Loader will then ask you to confirm the number of records you will be taking action on.
You will need to map your fields on the CSV file to the fields in Salesforce. While the Data Loader has an Auto-Match capability, it is a best practice to carefully review the “matched” fields to confirm they are correct. If you plan on doing this same type of data load on a regular basis (weekly imports, for example), then you can take advantage of the ability to “save” the Field Map for easier loading in the future.
As you finish up, you should select where you want your Success and Fail files to be saved, as these are valuable reference tools for future troubleshooting.
Data cleanliness is critical to success. Clean data starts with a good Data Upload Template. If you are receiving data from non-technical end-users, it is a good idea to provide a data upload template before the data load. A good data template will have the following labels for each column:
- Field Label = the name of a field that a user can see when viewing a page.
- API Name = the name of a field that the system uses.
- Data Type = the type and expected format the data should be received in. This is particularly important as it allows the end-user validate their data will fit within the field.
Once you receive a file from the end-user, you will need to review the data. Required fields must have values, and the data must conform to any validation rules in place in the system. Also, be sure to check for the standard data error of malformed email addresses (leading/trailing spaces or commas) along with the proper formatting of dates. If some data errors do slip by your review, the error file will show you exactly which records failed and give the reason why. Often, you can just use this file to “fix” the data and re-upload the fail file; rinse and repeat as necessary.
Business rules and workflows will be triggered by the data loads. Before loading data, be sure to review all workflows, especially ones that kick-off email notifications, otherwise you may end up ‘spamming’ your users with many unneeded notifications.
Data Loader is an easy-to-use, straight-forward way to get data into Salesforce. Everyone, from beginning admins to experienced developers, can take advantage of this tool. However, the tool alone will not guarantee successful data loads as you must have good data hygiene practices implemented.