Data Loader Upsert (Updating and Inserting records)

Data Loader UPSERT is one of the operation that performed using APEX Data Loader where Updation and Insertion of records can be done in Salesforce.

In this salesforce Tutorial we are going to learn about Data loader UPSERT operation and what are the requirements needed to update and Insert a record using Data Loader.

What is Record ID in Salesforce?

Record ID is the unique 15 digit number created for every record created in Salesforce. To find record ID in Salesforce User Interface go to any records and click on the URL as shown below.

ADVERTISEMENT
Record iD in Salesforce

To Update an existing record we require Record ID where for Inserting record we don’t need any record ID. We use CSV(Comma Separated Value) file to update a record using DataLoader in Salesforce.

As shown below we have created a CSV file with fields StudentInfo name, Course name, Fee paid, Subject1, Subject2, Subject3 and Record ID.

Data Loader Salesforce Upsert
  • Create a CSV file as shown above and Save the file.
  • From above CSV file we are going to Insert Pink record in Studentinfo__c object.
  • Coursename__c is going to updated from B.Sc to M.Sc using record ID.

Updating and Inserting a Record using Data loader UPSERT

Now go open Data Loader and login using username and password.

  • Click on Upsert function and click on next button.
Data Loader Salesforce Upsert
  • Select the object from the list.
  • Click browse to upload CSV file which we created.
  • Click on Next button.
Data Loader Salesforce Upsert
  • Initialization of UPSERT operation succeeded.
  • Click on OK button

Mapping Fields.

Data Loader Salesforce Upsert
  • Click on Auto-Match fields to column.
  • Drag the Salesforce fields down to the column mapping.
  • To remove a mapping, select a row and click Delete.
Data Loader Salesforce Upsert
  • Click on Next Button.
Data Loader Salesforce Upsert
  • Now click on Yes Button.
Data Loader Salesforce Upsert

As shown above UPSERT operation is successful using Salesforce Dataloader. Let us check the Object. Go to Studentinfo__C object.

Data Loader Salesforce Upsert

Previously we don’t have Pink record in Studentinfo__C object. Now we observe that new record is created.

Data Loader Salesforce Upsert

As we discussed about UPSERT operation in Data Loader, both Inserting and Updating records will happen at a time. The Coursename__c in studentinfo name called black is updated from B.Sc to M.SC successfully.

Conclusion

In this Salesforce Tutorial we have learned about UPSERT operation. In our upcoming Salesforce admin Tutorial we are going to learn about Deleting and Exporting records using Apex Data Loader.