Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

***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.

Note

The SObject Tree resource is available through a pilot program in the service version 43.0, which is the latest as of October, 2015. If you want to use this Snap in the service version 43.0, you should ask your Salesforce.com support to enable the SObject Tree resource for your account. It will be generally available in the versions later than 43.0.

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):

Code Block
languagejs
[ { "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


Multiexcerpt macro
nameME_Service_Version

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

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute


Excerpt


Warning

The field labels for this Snap are updated to title case. If you have existing Pipelines that include the field names in the error messages, you must update those Pipelines to use the new field labels.


 Examples


Creating Multiple Records

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

Image Modified

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).

Image Modified


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

Successful execution of the Snap gives the following preview:

Image Modified

Downloads

Info

Important Steps to Successfully Reuse Pipelines

  • Download and import the Pipeline into SnapLogic.

  • Configure Snap accounts as applicable.

  • Provide Pipeline parameters as applicable.

    Multiexcerpt include macro
    namedownload_instructions
    pageOpenAPI

    Attachments
    patterns*.slp, *.json


    Insert excerpt
    Salesforce Snap Pack
    Salesforce Snap Pack
    nopaneltrue