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.
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.
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.
- 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.
Now go open Data Loader and login using username and password.
- Click on Upsert function and click on next button.
- Select the object from the list.
- Click browse to upload CSV file which we created.
- Click on Next button.
- Initialization of UPSERT operation succeeded.
- Click on OK button
- 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.
- Click on Next Button.
- Now click on Yes Button.
As shown above UPSERT operation is successful using Salesforce Dataloader. Let us check the Object. Go to Studentinfo__C object.
Previously we don’t have Pink record in Studentinfo__C object. Now we observe that new record is created.
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.
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.