Salesforce Batch Create

In this article

***This feature is available only to those Salesforce users that have the access to the Limited Release of the Salesforce Batch Create functionality.

Overview

The Salesforce Batch Create Snap is a Write-type Snap that enables you to create multiple Salesforce object records in each Salesforce REST API request.

To use newer Salesforce objects, use the latest API versions where those objects are available.

Prerequisites

  • A valid Salesforce account with the required permissions.

  • The composite/tree resource should be enabled for your Salesforce account credential.

Support for Ultra Pipelines  

Works in Ultra Pipelines.

Limitations and Known Issues

None.

Snap Views

View Type

View Format

Number of Views

Examples of Upstream and Downstream Snap

Description

Input

Document

  • Min:1

  • Max:1

  • Mapper

  • JSON Parser

A stream of documents. The following example shows a list of two documents for Account SObject records. The first document has two nested Contact records, and the second document has one nested child. Account record and one nested Contact records. Therefore, this stream of documents should insert total of 6 records (3 Account records and 3 Contact records):

[ { "attributes": { "type": "Account", "referenceId": "ref1" }, 
"name": "SampleAccount1", "phone": "1234567890", 
"website": "www.salesforce.com", "numberOfEmployees": "100", 
"type": "Analyst", "industry": "Banking", 
"Contacts": { "records": [ { "attributes": { "type": "Contact", "referenceId": "ref2" }, "lastname": "Smith", "Title": "President", "email": "sample@salesforce.com" }, { "attributes": { "type": "Contact", "referenceId": "ref3" }, "lastname": "Evans", "title": "Vice President", "email": "sample@salesforce.com" } ] } }, 
{ "attributes": { "type": "Account", "referenceId": "ref4" }, "name": "SampleAccount2", "phone": "1234567890", "website": "www.salesforce.com", "numberOfEmployees": "52000", "type": "Analyst", "industry": "Banking", "childAccounts": { "records": [ { "attributes": { "type": "Account", "referenceId": "ref5" }, "name": "SampleChildAccount1", "phone": "1234567890", "website": "www.salesforce.com", "numberOfEmployees": "100", "type": "Analyst", "industry": "Banking" } ] },
"Contacts": { "records": [ { "attributes": { "type": "Contact", "referenceId": "ref6" }, "lastname": "Jones", "title": "President", "email": "sample@salesforce.com" } ] } } ]

Output

Document

  • Min:0

  • Max:1

  • Mapper

  • Copy

  • JSON Formatter

A stream of resulting documents, each of which contains the "id" field for the record created and the "original" field for the corresponding input record. An example of the expected output is attached below (Salesforce_Batch_Create_Output.json.

Error

Document

  • Min: 1

  • Max: 1

N/A

The error view contains error, reason, resolution and stack trace. For more information, see Handling Errors with an Error Pipeline.

Snap Settings

Field

Field Type

Description


Label*

 

String

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

Default Value: Salesforce Batch Create
Example: Salesforce_Batch_Create

Service Version*

String/Expression/Suggestion

Specify the version number associated with the Salesforce service that you want to connect to. Alternatively, click the Suggestion  icon to fetch the list of versions and select the desired version.

Default Value52.0 
Example41.0

Batch Size*


Integer

Specify the number of records batched per request. If the input has 100,000  records, and the batch size is set to 200, the total number of requests would be 500.

The maximum allowed batch size is 200.

Default Value: 200
Example: 200

Auto-generated Reference ID


Checkbox

Each record in the input document should contain a reference Id field, which should have a unique value so that each item in the result can be correlated to an input record. Select this checkbox to enable the Snap to automatically generate and overwrite the reference Id values. 

Default Value: Selected

Nested Records
 

Checkbox

Select this checkbox if input documents are expected to have nested records.  If input documents are not nested and this property is selected, the Snap will function as expected with small performance penalty. If input documents are nested, but this property is not selected, the Snap will fail to correlate results to the corresponding input documents and will throw an error. 

Default Value:  Not selected

Pass Through


Checkbox

Select this checkbox to pass the input document the output view under the key 'original'.

If you deselect this checkbox, the input document will not be passed and there is no "original" key in the output document.

Default Value:  Selected

Snap Execution

Dropdown list

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Examples


Creating Multiple Records

The following example Pipeline of Salesforce Batch Create Snap shows how to create multiple records in Salesforce in a batch.

Download the Pipeline and the sample input file for the File Reader Snap.

In the Pipeline execution:

A JSON Generator Snap is used to provide object records to a Salesforce object (in this case, to the Account object).


The Salesforce Batch Create Snap creates and adds all the records to the Account object:

Successful execution of the Snap gives the following preview:

Downloads

Important steps to successfully reuse Pipelines

  1. Download and import the pipeline into the SnapLogic application.
  2. Configure Snap accounts as applicable.
  3. Provide pipeline parameters as applicable.

  File Modified

File nested.json

Sept 27, 2019 by Mohammed Iqbal

File Salesforce_BatchCreate.slp

Sept 27, 2019 by Mohammed Iqbal

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
August 2024438patches28040 Latest

Fixed an issue with the Salesforce SOQL Snap where the URL encoding was improperly applied to sandbox instance URLs. Now, the Snap ensures URL sandbox instance URLs are properly encoded.

Breaking change from Salesforce

Salesforce is retiring some of the hostnames for non-enhanced domains from August 2024:

  • Redirections for legacy (non-enhanced) hostnames stop in production orgs and demo orgs. Production orgs get this release starting in January 2025.

  • Redirections for legacy (non-enhanced) hostnames stopped in sandboxes, Developer Edition orgs, patch orgs, scratch orgs, and Trailhead Playgrounds.

When deploying a new My Domain, including enhanced domains, Salesforce automatically redirects previous URLs. For detailed information, such as hostname formats for legacy (non-enhanced) domains, refer to the Prepare for the End of Redirections for Non-Enhanced Domains.

To align with Salesforce’s redirection changes for non-enhanced domains, the classic URL format (https://snaplogic--devqa.my.salesforce.com/) is no longer supported for Sandbox environments. As a result, any existing Salesforce pipelines using classic URLs will stop functioning as before.

Workaround

To run your pipelines successfully, you must append sandbox to your classic URLs: https://snaplogic--devqa.sandbox.my.salesforce.com/

Learn more about the enhanced domains deployment by Salesforce.

August 2024main27765 StableUpgraded the org.json.json library from v20090211 to v20240303, which is fully backward-compatible.
May 2024437patches27307 Latest

Fixed authentication issues with the Salesforce Subscriber Snap in the Ultra Pipeline to ensure the Snap reauthenticates and reconnects as expected.

May 2024

main26341

 

Stable

Updated and certified against the current SnapLogic Platform release.

February 2024436patches25626 LatestEnhanced the Salesforce Bulk Create, Bulk Delete, Bulk Query, Bulk Update, and Salesforce Bulk Upsert Snaps to include the complete error details under the original object that contains the copies of the failed input records.
February 2024436patches25192 Latest

Fixed an issue with the Salesforce Mutual Authentication Account where the 8443 port was not used while authorizing the account. Now, the access token request uses the 8443 port for authorizing the Mutual Authentication Account.

Breaking change

Prior to 436patches25192, the Salesforce Mutual Authentication Account supported default Login URLs such as https://login.salesforce.com and https://test.salesforce.com. From 436patches25192, this account no longer supports the default Login URLs—your existing pipelines using the Mutual Authentication Account with the default Login URLs might break.

To prevent this breaking change, you must provide a valid Salesforce Login URL as part of your account configuration.

February 2024main25112 StableEnhanced the Salesforce Bulk Query Snap with expression support for the Include Deleted Records checkbox.
November 2023435patches24747 LatestFixed an issue that caused the input stream to not close properly, which resulted in stale connections.
November 2023435patches24368 Latest

Enhanced the performance of the Salesforce Bulk Query Snap with a new Maximum threads field. This field enables you to download query results simultaneously in multiple threads.

November 2023435patches24006 Latest

Enhanced the Salesforce Read Snap by adding expression enablement to the following checkboxes:

  • Use PK chunking if supported

  • Include Deleted Records

November 2023main23721 StableUpdated and certified against the current SnapLogic Platform release.
August 2023434patches23646 LatestFixed an issue where a long-running pipeline containing the Salesforce Subscriber Snap would suddenly stop responding.
August 2023434patches22537 Latest

Improved the Salesforce Bulk Upsert Snap error messages by limiting the length of the reason displayed with the error.

August 2023main22460 StableUpdated and certified against the current SnapLogic Platform release.
May 2023433patches21367 Latest
  • The Salesforce SOQL Snap now honors the selection of the Match Data Type checkbox when the value entered for Batch Size is greater than 50,000.

  • The Salesforce Read Snap now honors the selection of the Match Data Type checkbox if the Use PK chunking if supported checkbox is also selected.

May 2023

main21015 

Stable

Upgraded with the latest SnapLogic Platform release.

February 2023432patches20586 Latest

Fixed an issue with the Salesforce SOQL and Salesforce Read Snaps where the Match Data Type checkbox selection was not honored if the Salesforce API field was set to Bulk API.

February 2023432patches20393 Latest
February 2023432patches20145 LatestFixed an issue with the Salesforce Read Snap that was causing an error for the Time data type.
February 2023432patches20087  Latest

The Salesforce Create, Update, and Upsert Snaps now include an Apply active assignment rules checkbox so you can control whether to use assignment rules for the selected object

February 2023

432patches20008

 Latest
  • Fixed an issue with the Salesforce Read Snap where using the bulk API request would fail due to column specification.
  • Added support to use PK chunking on any batch size with the bulk API request and to automatically disable PK chunking if it is known that it cannot be done

February 2023main19844 StableUpgraded with the latest SnapLogic Platform release.
November 2022main18944 Stable Upgraded with the latest SnapLogic Platform release.
October 2022430patches18769 Latest
  • The Salesforce Bulk Query Snap now includes the following checkboxes:

    • Match Data Type: Select this checkbox to match the data types of the bulk query job results.

    • Include Deleted Records: Select this checkbox to include deleted records in the query result.

  • The Salesforce Delete Snap in REST API no longer fails with NPE if a new OAuth2 account is used.

  • The Salesforce Read Snap now stops gracefully on a forced stop (without throwing cryptic errors).

  • The Salesforce Update and Salesforce Upsert Snaps no longer fail with the message "Error occurred while executing request to Salesforce.com" when a redirection is needed.

September 2022430patches18125 Latest

The Salesforce Bulk Create, Salesforce Bulk Delete, and Salesforce Bulk Update Snaps are now working as expected without displaying the error Error while processing Data and without returning 301-error while processing the data.

September 2022430patches18036 Latest

The Salesforce Read Snap now correctly parses the 2-byte UTF-8 characters in Windows OS in the PK chunking mode.

August 2022main17386 Stable
  • Updates in Salesforce Subscriber Snap:

    • CometD version upgrade from 5.0.9 to 7.0.6 (latest).

    • The simplified logging provides useful diagnostic information without logging any sensitive data.

    • The Snap asynchronously makes callbacks or listens to the CometD API to identify and respond to specific events.

    • The Snap processes the most recent message so that it can send that replay ID if there is a need to resubscribe. If the server responds with an invalid replay ID, the Snap automatically sets the Replay ID value to -2 to get all available messages.

  • You can select the Null Setting with Bulk API checkbox in the Salesforce Update, Salesforce Create, and Salesforce Upsert Snaps to format null values in the input document.

4.29 Patch

429patches16708 Latest
  • Updates in Salesforce Subscriber Snap:
    • Upgraded the Cometd version from 5.0.9 to the latest 7.0.6 version.
    • Fixed an issue where the Snap reported an error and stopped only at the next resubscribe attempt when it encountered the daily limit exceeded error. Now, the Snap displays the error and stops immediately when it encounters the daily limit exceeded error.
    • Simplified the logging that provides useful diagnostic information without logging any sensitive data.
    • Enhanced the Snap design to make the callbacks or listeners asynchronously by the Cometd API when there is a specific event, and the Snap responds accordingly.
    • Enhanced the tracking of replay ID of the most recent message processed so that Snap can send that replay ID if there is a need to resubscribe. If the server responds that the replay ID is invalid, Snap automatically sets the Replay ID value to -2 to get all available messages.
  • Made the Null Setting with Bulk API checkbox in the Salesforce Update, Salesforce Create, and Salesforce Upsert Snaps visible, to format a null value.

4.29main15993 StableUpgraded with the latest SnapLogic Platform release.
4.28 Patch428patches14355 

Latest

Fixed an issue with Salesforce Snaps where the Service Version could not be retrieved from SFDC due to a blocked URL, failing the Snap execution.

4.28main14627 StableUpgraded with the latest SnapLogic Platform release.
4.27 Patch

427patches14079

 Latest

Fixed an issue with the Salesforce Subscriber Snap where the Snap was unable to re-subscribe to a topic if it did not receive any message for 72 hours —stopped and displayed an error message. With this fix, the Snap automatically sets the Replay ID value to -2 when:

  • the specified Replay ID is invalid or outside the retention window.

  • the most recently received Replay ID for an event is outside the 72-hour retention window.

4.27 Patch427patches13944 LatestFixed an issue with Salesforce accounts, where an account password containing special characters and an empty security token was not properly encoded and the account was not validated.
4.27 Patch427patches13789 Latest

Fixed the following issues with Salesforce Snaps:

  • High memory use due to leaked resources.

  • Hung Pipelines due to blocked threads.

4.27main12833Stable