...
Snap type:
...
Write
...
Description:
...
In this article
Table of Contents | ||||
---|---|---|---|---|
|
Overview
The Salesforce Upsert Snap is a Write-type Snap that enables you to upsert (that is, a simple update or insert procedure
...
) object records in
...
Salesforce in Bulk API 1.0 or REST API mode.
...
The Snap in
...
Bulk API mode
...
submits a batch job and writes the batch job information to the output view
...
, 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 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: |
...
|
...
|
...
|
...
None
...
- Ultra pipelines: May work in Ultra Pipelines.
- Spark mode: May work in Spark mode.
...
This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Salesforce Account for information on setting up this type of account.
...
Note | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Prerequisites
None.
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.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Snap Views
View Type | View Format | Number of Views | Examples of Upstream/Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| Each document contains Map data for an external ID and records of field and value pairs. |
Output |
...
Document |
|
| 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 |
...
and a key-value pair of created:false for each successfully-updated record or created:true for each successfully-created record. |
...
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
...
Document |
| 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 | Field Dependency | Description | |
---|---|---|---|---|
Label* | String | None | 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 |
...
Service version
...
Required. The version number associated with the Salesforce service that you want to connect to."v34.0" for REST API or "34.0" for Bulk API
Example: 34.0
Default value: 34.0
...
Batch size
...
Pipeline. Default Value: Salesforce Upsert | ||||||||||
Service Version* | String/Expression/Suggestion | None |
| |||||||
Batch Size* | Integer/Expression | None | Specify the number of records to be processed in a batch.
|
...
|
...
Object type
...
Default Value: 200 | ||||
Object Type* | String/Expression/Suggestion | None | Specify the name of the Salesforce object |
...
or select one from the suggested list. Default Value: Account |
...
Salesforce API
...
Account
| ||||
Salesforce API | Dropdown list | None | 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). |
...
|
...
Bulk API |
...
Example: |
...
REST API |
...
External ID |
...
...
Field* | String/Expression/Suggestion | None | Specify the external ID field that represents the unique externalized key of the object.
|
...
|
...
Default Value: [None] |
...
employee_number__c | ||||
Bulk Content Type | Dropdown list | None | Select the content type to be used in Bulk API. Available options are:
|
Default value: [None]
Default Value: XML | |
Null Setting with Bulk API |
...
Checkbox | None | Select this checkbox to set the nullable fields to null in the Salesforce object if there are null values in the input document |
...
. This field works only if you select Bulk API mode in the Salesforce |
...
Related object
...
API field. |
Default value: False
Default Value: Deselected | ||||
Related Object | String/Expression/Suggestion | None | Enter or select a related parent object. |
...
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. |
...
|
Example: Account
Default |
...
Value: |
...
[None] | |
Related |
...
External ID | String/Expression/Suggestion | None | Enter or select an external ID of the selected related parent object. |
...
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] |
...
AccountNumber__c |
...
Apply active assignment rules | Checkbox | Appears 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 (Account, Case, or Lead). If you deselect this checkbox, active assignment rules are not applied for the selected object type (Account, Case, or Lead). Default Value: Selected | |
Bulk API Serial mode | Checkbox |
...
None | Select this checkbox to enable the Bulk API |
...
to run in Serial mode. |
...
|
...
to run in Parallel mode. This is only relevant to BULK API. |
...
Default |
...
Value: Not selected (Parallel mode) | |
Standardize |
...
Error Output | Checkbox | None | Select this checkbox to enable the Snap to produce error output with Reason, Original, Stack trace and Resolution. |
...
you deselect this checkbox, the output view |
...
displays the input document along with the error message. Default |
...
Pass through
...
Value: Not selected |
Pass Through | Checkbox | None | Select this checkbox to pass the input document to the output view under the key ' |
...
If you deselect this checkbox, the input document is not passed and there is no ' Default |
...
Value: Selected |
Execute during preview
...
This property enables you to execute the Snap during the Save operation so that the output view can produce the preview data.
Default value: Not selected
| ||||||||||
Snap Execution | Dropdown list | None |
|
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. |
Examples
...
Sample Salesforce Pipeline: This pipeline uses several Salesforce Snaps to perform create, updated, delete, & lookup actions on Salesforce object records.
...
Upserting Department Record and Associating with an Employee Record
The following example Pipeline demonstrates how 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 |
---|---|
Upserting a new record in a Salesforce object
The following example Pipeline demonstrates how to upsert a new record in a Salesforce object
...
.
In the above pipeline execution:
...
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
...
.
...
4.7.0
- Updated the Snap with Standardize error output field.
December 20, 2014
...
...
...
title | Snap History |
---|
Upon successful execution, we can see the following output in the Snap's preview.
Downloads
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
Attachments | ||
---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|