Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
On this Page

In this article

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

Overview

The Salesforce Upsert Snap

type:

Write

Description:

This Snap provides the functionality to upsert (meaning

is a Write-type Snap that enables you to upsert (that is, a simple update or insert procedure

of

) object records in

Salesforce in

Salesforce in Bulk API 1.0 or REST API mode.

  The

The Snap in

Salesforce

Bulk API mode

submits batch jobs and sends

submits a batch job and writes the batch job information to the output view

for

, which should be passed to the Salesforce Poller Snap to check the result of the batch job. More specifically, the Salesforce Upsert Snap should not be thought of as the combination of the Salesforce Update and Salesforce Create Snaps.

Info

The Salesforce Upsert Snap operates exclusively on the

external

External ID field, not on the Salesforce-generated record ID. If a record for a given external ID exists, the record is updated with the input record data. If no record exists for a given external ID, a new record is created with the input record data. The external ID is used as the unique record identifier from an external system and can be useful when you want to synchronize an external system to Salesforce.com

To create a new external ID field for an Account object:


 

  1. Log in to your Salesforce account.
  2. Go to App Setup > Customize > Account > Fields > New. 
  3. Follow the instructions and create a new custom field. 
Note
You must select the External ID checkbox in Salesforce. The Snap in REST API mode
upserts
upserts records to the Salesforce objects
and
 and returns results synchronously without the need for the Salesforce Poller Snap.



Note

Multiexcerpt include macro
macro_uuid400ce58f-0da5-4a11-ae68-7d54283f17be

Prerequisites:

nameSalesforce objects limitation
templateDataeJyLjgUAARUAuQ==
pageSalesforce Batch Create
addpanelfalse

Salesforce Upsert SettingsImage Added

Prerequisites

None.

Support and limitations:

Works in Ultra Pipelines.

Limitations and Known Issues

This Snap performs batch processing, that is, a batch of input documents are processed for each HTTP request sent to Salesforce. Values of all the expression-enabled fields must remain constant during the Snap execution or validation. Hence, all expression fields can support Pipeline parameters only when they are expression-enabled. The input data parameters are not supported for expression fields, for example, $serviceVersion.


Account: 

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring Salesforce Accounts for information on setting up this type of account.

Views:

Input

This Snap has exactly one input view and receives documents in the view.

Support for Ultra Pipelines

Works in Ultra Pipelines.

Snap Views

View TypeView FormatNumber of ViewsExamples of Upstream/Downstream SnapsDescription
InputDocument
  • Min:1
  • Max:1
  • Mapper 
  • Copy
Each document contains Map data for an external ID and records of field and value pairs.
Output
This Snap has at most one output view and produces documents in the view. Each
Document
  • Min:0
  • Max:1
  • Poller
  • JSON Formatter
Each document contains Map data that includes a Job ID, a Batch ID, a URL, and an array of records if it is in Bulk API mode. If it is executed in REST API mode, each document contains input data
plus
and a key-value pair of created:false for each successfully-updated record or created:true for each successfully-created record.
 If
 
If the Snap is executed in Bulk API mode and a new record is created, the ID field and its value is included in the output data. However, if the Snap is executed in REST API and a new record is created, the ID field is not included in the output data.
Error

This Snap has one optional error view and might produce documents in the view if the input data causes an error in REST API. Each document contains key-value pairs from the input view and an error message from Salesforce.com. The error message is in the value of the error key. If the Snap is in Bulk API, a similar set of data is available in the error view of the Salesforce Poller Snap connected to this Snap directly or indirectly.

Settings

Label

The

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

FieldField TypeField DependencyDescription

Label*


StringNone

Specify a unique 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

Pipeline.

Default Value: Salesforce Upsert
ExampleSalesforce Upsert

Service Version*


String/Expression/SuggestionNone

Multiexcerpt include macro
nameME_Service_Version
pageSalesforce Batch Create

Batch Size*

Integer/ExpressionNone

Specify the number of records to be processed in a batch.

Info

In Bulk API, this

property

value is allowed to be from 1 through 10,000. Each input document forms one Salesforce record to be upserted. The Snap stores records in memory until the number of records reaches the batch size and sends the request to SFDC in a single batch.

   Increasing

 Increasing the batch size increases the amount of memory used during the data load. Decreasing the batch size increases the number of API calls against Salesforce.

In REST API, the Snap can upsert only one record per each request regardless of the value

of

you specify in the Batch

size property

Size field.

Example

Default Value: 200

, 10000


Default value

Example:

200

1000

Object Type*
  

Define
String/Expression/SuggestionNone

Specify the name of the Salesforce object

, such as Account

or select one from the suggested list.

Default Value:

  

 Account
Example:

  

 Account

Note


Salesforce API

*


Dropdown listNone

Set the Salesforce API mode to Bulk API or REST API. The Snap in REST API mode creates one record at a time and returns the results at the output. REST API can be simpler and faster if the number of records to be created is small (a few).

Default Value: Bulk API
Example: REST API

External ID Field*

Represents



String/Expression/SuggestionNone

Specify the external ID field that represents the unique externalized key of the object.

Info

The external ID determines the locator of the object on the Salesforce object instead of using the ID field on the object.

This field is suggestible.

 


Note
You
should
must select the
check box
checkboxExternal ID: Set this field as the unique record identifier from an external system, when you create an external ID field in the Salesforce
.com web page
 portal.

Default Value:  [None]
Exampleemployee_number__c

Bulk Content Type

Dropdown listNone

Select the content type to be used in Bulk API. 

Available options are:

  • XML: Data in XML format.

  • CSV: Data in CSV format.

Default Value: XML
Example: CSV

Null Setting
With
with Bulk API
If selected, in Bulk API mode,
CheckboxNone

Select this checkbox to set the nullable fields to null in the Salesforce object if there are null values in the input document

can set nullable fields null

. This field works only if you select Bulk API mode in the Salesforce

object

API field.

 

Default Value:

 False

Deselected
Example: Selected


Related Object



String/Expression/SuggestionNone

Enter or select a related parent object.

This property

The value in this field does not affect the Snap operation on records in Salesforce. It is provided for the property suggest and the input schema suggest only. 

Default Value:

 

[None]
Example:

 

Account

Related External ID


String/Expression/SuggestionNone

Enter or select an external ID of the selected related parent object.

This property

The value in this field does not affect the Snap operation on records in Salesforce. It is provided for the property suggest and the input schema suggest only. 

Default Value: [None]
Example:

 AccountNumber

AccountNumber__c

Apply active assignment rulesCheckboxAppears when you select REST API from the Salesforce API dropdown and when the Object Type is Account, Case, or Lead.

Select this checkbox to apply the active assignment rules for the selected object type (AccountCase, or Lead).

If you deselect this checkbox, active assignment rules are not applied for the selected object type (AccountCase, or Lead).

Default Value: 

[None]

Selected

Bulk API Serial mode

If selected,


CheckboxNone

Select this checkbox to enable the Bulk API

will

to run in Serial mode.

If not selected,


Deselect this checkbox to enable the Bulk API

will

to run in Parallel mode. This is only relevant to BULK API. 

Default Value: Not selected (Parallel mode)

Standardize

error outputIf checked, the Snap will produce the

Error Output

CheckboxNone

Select this checkbox to enable the Snap to produce error output with Reason, Original, Stack trace and Resolution.
If

unchecked

you deselect this checkbox, the output view

will simply show

displays the input document along with the error message.

Default Value:  Not selected

Pass

throughIf selected,

Through


CheckboxNone

Select this checkbox to pass the input document

will be passed through

to the output view under the key 'original'.

If

Pass through is not selected

you deselect this checkbox, the input document

will

is not

be

passed and there is no

"

'original

" key

' key in the output document.

Default Value:  Selected

Info

For Bulk APIs, if you select this

check box

checkbox and if the Batch size is equal to 1, the input document is passed to the output view under the key original. If the Batch size is greater than 1, the list of input documents is displayed under Records and the input document is not included under the original key.

Multiexcerpt include macroname


Snap Execution

page
Dropdown list
SOAP Execute
None

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute


Note

If you want to get the resulting status for each record to be upserted in Bulk API mode, you must connect a Salesforce Poller Snap after the Salesforce Upsert Snap.

Insert excerptSalesforce Batch CreateSalesforce Batch Createnopaneltrue


Examples

Upserting Department

Record And Associating With An

Record and Associating with an Employee Record

The following example Pipeline demonstrates how you can to upsert the department record in CSV format and associate that record with an employee record. We also pass null value for a particular field to demonstrate that null values in CSV file format type does not hinder the Pipeline execution.

First, we configure the Sequence Snap to generate a sample set of Department data.


Then, we configure the Mapper Snap to prepare (transform) and pass the department data (input) to the Salesforce Upsert Snap. Note that we pass null value for location, but that does not hinder the Pipeline execution.

Upon validation, the Snap passes the following data to the downstream Salesforce Upsert Snap. Note the null value under location column.

Then, we configure the Salesforce Upsert Snap to upsert the department record into Salesforce. We use the Bulk Content Type as CSV and the API as Bulk API. Note that we configure the Related External ID field to associate the department record with the employee record.

The Snap passes the following batch information to the downstream Salesforce Poller Snap.

We then configure the Salesforce Poller Snap to poll the status of the batch job submitted to Salesforce application from the Salesforce Upsert Snap. Upon validation, the Snap creates the record for department and associates it with the employee record.

Salesforce Poller Snap Configuration

Salesforce Poller Snap Output

Download this Pipeline.

Upserting a new record in a Salesforce object

The following example Pipeline demonstarates demonstrates how to upsert a new record in a Salesforce object.

First, we configure the Mapper Snap to map the Object record details (that need to be upserted using External ID) to the input view of Salesforce Upsert Snap.

Then, we configure the Salesforce Upsert Snap to update the record (using its External ID) in the Account object.


Upon successful execution, we can see the following output in the Snap's preview.

Downloads

Multiexcerpt include macro
namedownload_instructions
pageOpenAPI

Attachments
patterns.*slp, .*zip

Insert excerpt
Salesforce Snap Pack
Salesforce Snap Pack
nopaneltrue