- 29 Mar 2023
- 6 Minutes to read
Upsert Salesforce Data
- Updated on 29 Mar 2023
- 6 Minutes to read
Upsert is a combination of Updating and Inserting. If a record in a file matches an existing record, the existing record is updated with the values in your file. The record is created as a new entity if no match is found.
The following articles describe using Single Dataloader to upsert data into Salesforce. The data is upserted via a CSV file.
- Log in to your ARM account.
- Hover your mouse over the
Dataloadermodule and select
Upserton the right side of the screen.
- Choose your
Salesforce Organd your org environment (
Production or Development Edition,
- The corresponding
Usernameare automatically generated based on the above selection.
Login and Fetch Objectsto fetch all the objects from your Salesforce Org.
- Select the object you wish to upsert the data. For example,
Lead, etc. You can use the
searchfunction to search through your objects and the
filterbutton to filter your standard/custom objects quickly.
- Import your file from your local directory on the next screen. Upload the
CSVfile you wish to import by clicking the
- A notification pop-up will display the number of records that will be impacted. Click
- The next step is to prepare your field mappings. Field mappings match columns in your CSV to fields in your Salesforce Org.
- You can automatically map the members and the fields using
Automap. It compares the destination fields with the fields available in uploaded CSV files, and if both match, the value is selected automatically.
- The number of fields mapped out of the total number of fields is displayed below the
- Use the
searchoption to look up a field by name from the long list to map it.
- Use the
Filterdropdown to choose which fields to display:
All:Displays all fields, whether they have been mapped or not.
Mapped:Displays only the fields which have been mapped yet.
Unmapped:Displays only the fields which haven't been mapped yet.
After selecting the filter, the list updates automatically as you map or unmap each field.
- Make sure you have mapped all the required fields. Otherwise, you can't move forward. Click
- On the
Process Summaryscreen, you can:
- Give the process/job a
- Select the
Category. Categories are used to classify and group similar processes having similar functionality. In simple terms, you are assigning similar processes to a category. You can either select an existing category or create a new category by clicking the
- Select the
External ID field. An external ID field is simply a field that is a unique identifier for your record, other than the Salesforce ID, usually coming from an external system. For example, if you are importing accounts, you may have a field called ERP Account Number, the identifier for your Accounts within your ERP system.
- View the main
- View the operation
- View the number of impacted
Use Bulk API.About Bulk APIThe Bulk API is based on REST principles and is optimized for inserting, updating, and deleting large data sets. You can use the Bulk API to process jobs in serial or parallel mode. Processing batches serially means running them one after another, while processing batches in parallel means running multiple batches simultaneously. When you run a bulk API job, processing more batches in parallel means giving that job a higher degree of parallelism, providing better overall data throughput.
- Give the process/job a
- You can schedule your tasks so they start running regularly. You can choose between
- Finally, click
Saveto save your task and run it later.
- Your task is listed on top of the lists in the
Runto start the Dataloader immediately before the scheduled time.
- Select the criteria you can set for the dataloader process to continue:
Use Bulk API (Batch API will be used if the option is not enabled)
The Bulk API is based on REST principles and is optimized for inserting, updating, and deleting large data sets.
You can use the Bulk API to process jobs in serial or parallel mode. Processing batches serially means running them one after another, while processing batches in parallel means running multiple batches simultaneously.
When you run a Bulk API job, processing more batches in parallel means giving that job a higher degree of parallelism, giving your overall run better data throughput. When you run a Bulk API job, processing more batches in parallel means giving that job a higher degree of parallelism, giving your overall run better data throughput.
Note: When performing multiple upsert operations into the same destination org while the ongoing jobs are still running, choosing the
Serial Modeis recommended.
Whenever the Bulk API checkbox is left unchecked, the Batch API is used.
Salesforce Batch API is based on SOAP principles and is optimized for real-time client applications that update small numbers of records at a time. Although SOAP API can also process large numbers of records, it becomes less practical when the data sets contain hundreds of thousands of records. In those cases, Bulk API is the best option. Batch API processes data in smaller batches than Bulk API, resulting in a higher API call usage per operation on large volumes of data.
Note: When you run a Bulk API job, processing more batches in parallel means giving that job a higher degree of parallelism, giving your overall run better data throughput.
Disable workflow rules
All the workflows of the Salesforce objects are deactivated, and the data is transferred from the source to the destination sandbox. Once the migration is complete, workflows are reactivated.
Disable Validation Rules
Validation rules verify that the data a user enters in a record meets the specified criteria before the user can save the record. On selection, all the validation rules of the Salesforce objects are deactivated, and the data is transferred from the source to the destination sandbox. Once the migration is complete, validation rules are reactivated.
Insert/Update with null values
This will either insert or update record field values with null (if the value is null in source org) in destination org.
Use UTF-8 file encoding for file read and write operations
Use UTF-8 as the internal representation of strings. Text is transcoded from the local encoding to UTF-8 when data is written to or read from a file. UTF-8 must be enabled in your data exclusively containing English alphabets. UTF-8 must be disabled if your data contains non-English alphabets. UTF-8 should be enabled by default as per Salesforce.
- The number of successful or failed records upserted can be seen in the
Results of Last Runsection. The values in this field are updated dynamically while the job is still running. You can view the records or download them to your local system. The records are generated in CSV format.
- The number of impacted records can be seen in the
Recordssection. The value in this field is updated dynamically while the job is still running.
Edit:Modifies or updates the process details.
Abort:Aborts the process while it is still running.
Schedule:Sets the schedule at which the process must run.
Delete:Deletes the upsert process.
Log:Provides information about the execution of the upserted task.
VR/WFR:ARM lists all the validations/workflow rules that were set. The UI lists all the validation rules, and users must enable them for the disabled validation rules (if required). For more info, refer to the article: Validation/ Workflow Rules. Sample VR/WFR attached:
Clone:Creates a copy (clone) of the insert process. Operation type and object name are displayed. Enter the
Process Namein the field. The default
Salesforce Orgis automatically selected. To choose a different org, use the dropdown list. Select the
Choose Different Data CSV Filecheck box to upload a different CSV file. Finally, click