There will be times you will need to do a mass update of records that cannot be easily done via the Salesforce Object Manager. The Data Loader will provide a way to export the Salesforce records you want to change and then update them based on the record id. This method will work on most Salesforce standard and custom objects.
You will need to be aware of any triggers/processes that run when doing an update on the record and/or field you are about to change so plan accordingly.
For this example we want to update the Account Type based on the Source field. We will do this by exporting the Account records from Salesforce. Once the export file is created we will manipulate a column to have the Account Type value to update. Finally, the data is updated back into the Salesforce record.
Exporting Salesforce Records:
See instructions for exporting records here: Using Data Loader to Export Records
Creating File for Updating Records:
- Open the export file and add a new column header named “Type”
- Either manually populate the Type field based on Source or use an Excel formula to create the values e.g, IF(B2= ‘2012 Expo’, ‘Dealer’, IF(B2 contains ‘Market List’, ‘Wholesaler’, ‘Builder’))
ID | Source | Type |
0014T000006wB1iQAE | 2012 Expo | Dealer |
0014T000006wB1jQAE | 2017 Market List | Wholesaler |
0014T000006wB7nQAE | 2018 Market List | Wholesaler |
0014T000006wB4MQAU | 2019 Trade Show | Builder |
NOTE: If using an Excel formula to populate column data, you will need to copy all values when done and paste as values into another column. This will ensure the data is saved and not the formula.
- Save the export file with the new data for update. Be sure it is in .csv format.
Update Records Using Data Loader:
- Open Data Loader and the Export
- Choose the Environment (e.g, Production) and click the Log in button
- Sign into the Organization. Provide a verification code if required and click the Allow button if presented.
- When screen updates to “Login Successful”, you are ready to start.
- Click the Next button
- From the list provided, click on the name of the object you will export data from. If you do not see the object, check the Show all Salesforce objects For this example we will choose Account.
- In the Choose CSV file, browse to the folder you stored the export file in (e.g., AccountDataforUpdate.csv). The default file is \Downloads\extract.csv.
NOTE: You must use a .csv file format to update records.
- Click the Next
- Salesforce will tell you how many records are available for update. Click OK.
- Next is the mapping. Click the Create or Edit Map If your export file has the correct column names you can click the Auto-Match Fields to Columns button. All matching field names will populate.
- Verify the auto mapping is correct. If matches were not found or those found are incorrect, use drag and drop to move Salesforce field names from the top to the bottom and map to the proper fields.
NOTE: If you will be using this import mapping more than once, you can click the Save Mapping button. The next time you use Data Loader you will click the Choose an Existing Map button and browse the saved .sdl file.
- Click the OK button and click the Next
- Salesforce will create two files when doing inserts and updates. One will include all records that were processed successfully. The other will include any records with errors and the status of those errors. By default it is stored in /Downloads/ but you can browse to another location.
- Click the Finish Click Yes when asked to begin.
- Data Loader will display Progress Information letting you know how many records are being updated. It will also alert of any errors that may occur.
- When the data have finished updating you will be presented with some options. You can click OK to finish and close. You can click View Extraction and see the data and open in Excel. Since we had no errors, we will click OK.
- Verify the updates in your Salesforce Organization.
- If any errors occurred, you can make corrections and do another update.