The Bulk API is a RESTful API that is optimal for loading or deleting large sets of data. You can use it to modify a large number of records asynchronously by submitting batches from an Excel sheet. Salesforce will process these batches in the background until they are all complete.
To use this API, first locate it in the API Palette and click and drag it into the Test Case.
Then complete the following steps:
- Add a Parameter Value Source to read the Excel/CSV file and specify the variable in which to store the data, e.g. ‘ExcelData’. (Refer to Read Data From Excel for more information on this step.)
- In the Object section, specify the target object in the Object field (e.g. ‘Account’).
- Select the Operation: Insert, Update, Delete, Upsert or Hard Delete. (Note: To perform a Hard Delete operation, the Salesforce Connection user must have the ‘Bulk API Hard Delete’ permission enabled.)
- Specify an Assignment Rule (if the ownership of the records should be defined using existing Salesforce Assignment Rules).
- In the Data section, enter the variable in which the Excel data is stored (e.g. ExcelData).
- In the Result section, specify the Result Name and Result Scope. (Refer to Common Test Step Parameters for more information on Scope.)
Notes on Data
When preparing your Excel file, please consider the following:
- Column-field matching: The Column headers in the Excel/CSV file must be an exact match for the Field Name (i.e. API Name) of the relevant field in Salesforce.
- Required fields: When inserting data into an object, all its required fields must be populated. For example, to insert Account records, Name must be a column header in the Excel file and must be populated for all rows.
- Salesforce IDs: To perform an operation on existing records, the unique Salesforce ID of the record must be specified. This applies to Update, Upsert, Delete or Hard Delete operations.