How to Upsert Data with Data Loader in Salesforce

In Salesforce, we have a robust data management tool, and that is Data Loader. It is more efficient than other data management tools offered in Salesforce. It also has one unique feature to upsert records, which means we can update and insert or create records within one operation.

In this Salesforce tutorial, I will explain to you the Upsert feature of Salesforce and also the procedure to upsert data with Data Loader in Salesforce.

What is Upsert in Salesforce Data Loader

Upsert is a combination of “update” and “insert.” It allows us to insert new records and update existing ones in a single operation, making data management more efficient.

In Salesforce, Data Loader Upsert is an operation in Data Loader in which we can operate both Updates and Insert to an existing record in Salesforce.

Upsert Data with Data Loader in Salesforce

To upsert the data with the data Loader in Salesforce, ensure you have access to the records in which you want to upsert the data.

In this example, I will explain the data upsert operation by upserting the leads data. Now follow the below steps, to upsert data using the data loader.

1. To update lead data, we need the required fields: Company Name, Last Name, and Status. Now, we need to create a CSV file with these fields, and for that, first, we will export the details of leads in a CSV file with these fields for the reference of creating a new CSV file.

See also  How to Mass Delete Leads in Salesforce

2. To export the leads, open the data loader, log in with your credentials, and click on the Export button. Then select the required fields of Leads, which are Company Name, Status, ID, and Last Name.

Then click on the Finish button to complete the export operation and save the export in a CSV file.

Create a CSV file for upsert data with Salesforce Data Loader

3. Now, from the exported CSV file, copy the Header columns and IDs of the records that you have to update.

Create a CSV file for upsert data in Salesforce with data Loader

4. Create a new CSV file and enter the header column copied from the exported CSV file. Enter the ID of the fields that you have to update, then enter the fields for new records except for the ID field.

You can refer to the below image to create a CSV file for the Upsert operation.

Upsert data with data loader in Salesforce

In the above CSV file, the leads with ID are the ones that will be updated and the lead records without ID are the ones that will be inserted or created in this upsert operation.

5. Open the data loader login with your credentials and click on the Upsert button.

Upsert data in Salesforce records using data loader

6. In this step, we will select the data object in which we have to upsert the records and, for that, activate the checkbox Show all Salesforce objects and then select the object.

In this example, I have selected the lead object and, after this, browse the CSV file that we have created in the above steps.

After this, click on the Next button.

Load Upserts using Data Loader in Salesforce

7. After the initialization of the selected CSV file, click on the OK button.

Salesforce update data using Upsert in Data loader

8. In this step, select the field between the field and email to match the selected object and click on the Next button.

Select Id upsert data with data loader in Salesforce

9. In this step, we will do the mapping between the records of the CSV file and the Object’s Lookup field names. To do that, click on the button Create or Edit a Map, then in the next window, click on the button Auto-Match Fields to Columns.

See also  Mass Update Territory on Opportunity records via Data Loader in Salesforce

As we click on this, the fields will be auto-matched with the column headers of the CSV file. After this, click on the OK button and then click the Next button.

Data Upsert in Salesforce using Data Loader

10. In this step, select the folder to save the location for the Errors and Success file in the upsert operation that can be accessed later.

At last, click on the Finish button.

Upset data through CSV file in Salesforce Data loader

11. In this step, click on the Yes button to proceed with the upsert operation.

Proceed Upsert operation with Salesforce Data Loader

12. After completing the upsert operation, we will get a message of success and errors that occurred during the operation. In this case, we can see that it displays 9 successful upserts and 0 errors.

To view the success records, click on the button View Successes.

Salesforce update data with data loader

Now, in the Data Loader CSV viewer, we can view the records that were successfully upgraded.

In the above image, we can see that 6 records were updated, and 3 records were inserted in this upsert operation.

Insert and update data in Salesforce using Upsert Data loader

In this way, we can create and update data in Salesforce using the Data loader Upsert.

Conclusion

Upserting data with Salesforce Data Loader is useful for Salesforce data management since it inserts and updates data in a single operation. It streamlines data management processes, improves efficiency, and ensures the accuracy of Salesforce records.

By following the blog, you might have good insights into the Upsert feature of Data Loader, and by following the above steps, you will be able to perform Upsert operations to manage the data of your org.

You may like to read: