# Salesforce batch operations
In addition to supporting Salesforce bulk operations, Workato supports Salesforce batch operations using the Salesforce sObject Collections
API (opens new window).
These operations enable you to create, update, or upsert up to 2,000 records at a time. Use these operations when processing smaller batches of Salesforce records or when performing multiple operations without using the Bulk API.
Workato supports the following Salesforce batch operations:
# Create records in batches
Create records in batches action
The Create records in batches action allows you to create up to 2,000 records in a single request. Select the Salesforce object you plan to create to use this action. For example, after selecting the Contact
object, the Contacts source list field and additional required fields appear.
Select Salesforce Contact object
You can source the list input data pill from various locations, such as a new CSV file in a file storage app, including Box, Amazon S3, and On-prem files. Refer to the List management documentation to learn more about using list inputs.
Select the list input data pill
Select any additional Salesforce fields in the Optional fields available section and map them.
Select optional fields
# Advanced configuration
Advanced configuration
In the Advanced configuration settings, choose whether to roll back if the batch operation fails. If you select Yes
, the following actions occur when you run your recipe:
Workato processes records in batches of up to 200 records each. If one record in a batch fails, the entire batch rolls back, but other batches remain unaffected.
For example, when processing 1,000 records, they are divided into five batches of 200 records each. If a record in the first batch fails, the entire first batch of 200 records rolls back. The remaining four batches proceed as normal.
The default setting is No
, which is recommended. Successful records remain processed, while additional logic in subsequent recipe steps handles the failed records.
# Output fields
This action provides two types of output fields:
- Successful records for the records created in Salesforce.
- Failed records for those that were not created.
Note that in Failed records, the Salesforce ID of the object is not available as an output data pill because no record is created.
# Successful records
Output data pill | Description |
---|---|
Salesforce ID | Internal Salesforce ID of the record created |
Success | For successful records, this value is true |
List size | The number of successfully created records |
List index | The position of each successfully processed record within a batch |
# Failed records
Output data pill | Description |
---|---|
Success | For failed records, this value is false |
Errors | An array that contains the Status code, Error message and Fields. Use the information here to determine why the records failed. |
List size | The number of records that failed to create |
List index | The position of each failed record within a batch |
# Update records in batches
Update records in batches action
The Update records in batches action enables you to update up to 2,000 records in a single request. Select the Salesforce object you plan to update to use this action. For example, after selecting the Account
object, the Accounts source list field and additional required fields appear. You must include the ID of the Salesforce object you plan to update, meaning the Salesforce ID must be present in one of the columns of your provided list.
Select Salesforce Contact object
You can source the list input data pill from various locations, such as a new CSV file in a file storage app, including Box, Amazon S3, and On-prem files. Refer to the List management documentation to learn more about using list inputs.
Select the list input data pill
Select any additional Salesforce fields in the Optional fields available section and map them.
Select optional fields
# Advanced configuration
Advanced configuration
In the Advanced configuration settings, choose whether to roll back if the batch operation fails. If you select Yes
, the following actions occur when you run your recipe:
Workato processes records in batches of up to 200 records each. If one record in a batch fails, the entire batch rolls back, but other batches remain unaffected.
For example, when processing 1,000 records, they are divided into five batches of 200 records each. If a record in the first batch fails, the entire first batch of 200 records rolls back. The remaining four batches proceed as normal.
The default setting is No
, which is recommended. Successful records remain processed, while additional logic in subsequent recipe steps handles the failed records.
# Output fields
This action provides two types of output fields:
- Successful records for the records updated in Salesforce.
- Failed records for those that were not updated.
# Successful records
Output data pill | Description |
---|---|
Salesforce ID | Internal Salesforce ID of the record updated |
Success | For successful records, this value is true |
List size | The number of successfully updated records |
List index | The position of each successfully processed record within a batch |
# Failed records
Output data pill | Description |
---|---|
Salesforce ID | Internal Salesforce ID of the record updated |
Success | For failed records, this value is false |
Errors | An array that contains the Status code, Error message and Fields. Use the information here to determine why the records failed and in error emails. |
List size | The number of records that failed to update |
List index | The position of each failed record within a batch |
# Upsert records in batches
Upsert records in batches action
The Upsert records in batches action allows you to update or insert up to 2,000 records per request. Select the Salesforce object you plan to create or update to use this action. Then, select a Primary key to upsert your record. Refer to the Create a primary key section to learn how to create a primary key.
For example, after selecting the Contact
object and Test id
primary key, the Contacts source list field and additional required fields appear.
Select object
You can source the list input data pill from various locations, such as a new CSV file in a file storage app, including Box, Amazon S3, and On-prem files. Refer to the List management documentation to learn more about using list inputs.
Select list input pill
Select any additional Salesforce fields in the Optional fields available section and map them.
Select optional fields
# Create a primary key
When using the Upsert records in batches action, you must select the Salesforce object you plan to upsert, as well as the Primary key. A Primary key in Salesforce is a unique identifier for each record. To execute the batch upsert action, your selected Salesforce object must include an External ID
field.
The External ID
field is a custom field that has the “External ID” attribute. It contains unique record identifiers from a system outside of Salesforce. The field must be a custom text, number, or email field marked as unique within Salesforce. It determines whether to create or update a record during the upsert process.
Complete the following steps to create an External ID
field to use as your Primary key:
Navigate to the Salesforce Setup menu and select the Object Manager tab.
Select the object where you plan to add the custom field. For example, Contact.
Navigate to the Fields & Relationships tab and select New.
Select the Data Type for the custom field. This example uses Text.
Click Next.
Configure the following fields:
Field Label
Enter a label to be used on displays, page layouts, reports, and list views. This example uses
Test id
.Length
Enter the maximum length for the field. This example uses
25
.Field Name
The Field Name is an internal reference used for integration purposes, such as custom links, custom s-controls, and the API. Changing the Field Name may affect existing integrations. The Field Name can only contain alphanumeric characters. It must begin with a letter, cannot end with an underscore, cannot contain two consecutive underscore characters, and must be unique across all
Contact
fields.Unique
Select the Unique checkbox to disallow duplicate values.
External ID
Select the External ID checkbox to set the field as the unique identifier from an external system.
Click Next.
Select the profiles to which you plan to grant edit access to this field through field-level security. If you do not add it to field-level security, the field is hidden from all profiles.
Click Next.
Select the page layouts that should include this field. The field is added as the last field in the first two-column section of these page layouts. If you do not select a layout, the field does not appear on any pages.
To change the location of this field on the page, you must customize the page layout.
Click Save.
After you create a custom field for the Contact object in Salesforce, it appears as an option in the Primary key dropdown menu in the Workato recipe editor. Select this new custom field to access the Contacts source list input field and all required fields for the object.
Primary key
# Advanced configuration
Advanced configuration
In the Advanced configuration settings, choose whether to roll back if the batch operation fails. If you select Yes
, the following actions occur when you run your recipe:
Workato processes records in batches of up to 200 records each. If one record in a batch fails, the entire batch rolls back, but other batches remain unaffected.
For example, when processing 1,000 records, they are divided into five batches of 200 records each. If a record in the first batch fails, the entire first batch of 200 records rolls back. The remaining four batches proceed as normal.
The default setting is No
, which is recommended. Successful records remain processed, while additional logic in subsequent recipe steps handles the failed records.
# Output fields
This action provides two types of output fields:
- Successful records for the records updated or created in Salesforce.
- Failed records for those that were not updated or created.
# Successful records
Output data pill | Description |
---|---|
Salesforce ID | The internal Salesforce ID of the created or updated record |
Success | For successful records, this value is true |
List size | The number of successfully processed records |
List index | The position of each successfully processed record within a batch |
# Failed records
Output data pill | Description |
---|---|
Salesforce ID | The internal Salesforce ID of the created or updated record |
Success | For failed records, this value is false |
Errors | An array that contains the Status code, Error message and Fields. Use this information to determine why the records failed and in error emails. |
List size | The number of records that failed during the upsert process |
List index | The position of each failed record within a batch |
Last updated: 6/20/2024, 9:58:25 PM