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