In this article

Overview

You can use this Snap to perform SOQL queries using Salesforce Bulk API 2.0.

Prerequisites

Valid Salesforce OAuth 2 account with Read permissions.

Support for Ultra Pipelines

Works in Ultra Pipelines.

In Ultra Pipelines, set the Batch Size as 1 for the Snap to process one document/record at a time.

Limitations

Snap Views

TypeFormatNumber of ViewsExamples of Upstream and Downstream SnapsDescription
Input Document
  • Min: 0
  • Max: 1
  • Mapper Snap
  • Filter
  • Router
A document containing values required for the bulk query.
OutputDocument
  • Min: 1
  • Max: 1
  • Document to Binary
  • Salesforce Upsert

A document containing the results of the query performed by the Snap.

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk (*): Indicates a mandatory field.

  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon (): Indicates that you can add fields in the field set.

  • Remove icon (): Indicates that you can remove fields from the field set.


FieldField TypeDescription

Label*

DefaultValue:Salesforce Bulk Query
Example
:Salesforce Bulk Query

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.


Service Version*

Default Value:52.0 






Example
:41.0

String/Expression/Suggestion

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

SOQL Query*

DefaultValue: None
Example
:"select FirstName, LastName from " + $object + " order by Name LIMIT 5"

"SELECT Name FROM Account"
"SELECT Id,Name,Phone FROM Account WHERE Id='" + $Id + "'and
Name='" + $name + "'"

String

Specify the query in SOQL format. You can enter a JavaScript expression that is evaluated each time the Snap is executed. As in the second example below, on each document received from the input view, the % symbols will be replaced with the value pointed to by the JSON path $.Id in the input data.

  • Do not use quotes for field names in the WHERE clause. Using quotes results in an error.
  • Use only single quotes for values in the WHERE clause, as using double quotes results in an error.
  • The above rules do not apply when using SnapLogic expressions; you can use quotes for the field names and values as applicable. 


Max Records Per Set*

Default Value:10000
Example
:5000

Integer/Expression

Specify the number of records you want the Snap to fetch in a single set.


Maximum threads


Default Value: 10
Example: 9

Integer/Expression

Specify the maximum number of threads to download query results simultaneously in multiple threads. The Snap uses the thread pool to download the query results.

  • The query results are downloaded only if the Maximum Records Per Set value is greater than or equal to 10000.

  • If you expect the query results to be large, we recommend that you increase the values of the Max Records Per Set and Maximum threads for optimal performance.

  • This field does not support upstream values for Maximum threads. However, it supports values from pipeline parameters.

Minimum value: 1
Maximum value: 200

Polling Interval*

Default Value5
Example
:10

Integer/Expression

Specify the number of seconds you want the Snap to wait between two queries. At each polling interval, the Snap checks the Bulk API query batch processing status.

Minimum value: 1
Maximum value: 60

Polling Timeout*

Default Value:3000
Example
:300

Integer/Expression

Specify the number of seconds into the query batch execution before the query fails if it receives no response. If the timeout occurs while waiting for the completion of the query batch execution, the Snap throws a SnapExecutionException.

Minimum value: 10 


Maximum Retry Attempts


Default 
Value
5
Example
1
Integer/Expression

Specify the maximum number of retry attempts the Snap must make in case of a network failure. 

Minimum value: 1

Retry Interval (seconds)

Default Value:3
Example
:3

Integer/Expression

Specify the minimum number of seconds the Snap must wait before attempting recovery from a network failure.

Minimum value: 0

Include Deleted Records

Expression/Checkbox

Select this checkbox to include deleted records in the query result. This feature is supported in Bulk API version 47.0 or later.

This field supports input values from the upstream Snap. However, it does not support pipeline parameters.

  • When you select the checkbox and enable the expression, the string value is displayed as true:

  • When you deselect the checkbox and disable the expression, the string value is displayed as false:


Match Data Type

Default ValueDeselected

Checkbox

Select this checkbox to match the data types of the bulk query job results. On selecting this checkbox, the Snap converts string values to the corresponding data types if the original data type is one of Boolean, Integer, Double, Currency, and Percent. 


The Salesforce response for null values is independent of the selection of the Match Data Type checkbox.


Display null or empty values as null


Default ValueDeselected

Checkbox

Select this checkbox to display empty string or null data as null in the output preview.

When you deselect this checkbox, the Snap displays an empty string or null data as blank in the output preview.

For a better understanding, refer to this Example.

The output in the Salesforce application remains unaffected. Regardless of the state of the checkbox (selected or deselected), the Salesforce record and its corresponding output continue to appear empty, as shown below: 


Object Type


Default Value
: N/A
Example: String

String/Expression

Appears on selecting the Match Data Type checkbox.

Specify the object type to match. Alternatively, select an object type from the suggestions list to match the data type.


This Snap does not support Net Zero Cloud Salesforce objects.


Snap Execution

DefaultValueValidate & Execute
Example
:Execute only

String

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, it 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.


Troubleshooting

ErrorReasonResolution
Invalid value: 201

The Maximum thread value is larger than the required maximum, which is 200.

Provide 200 or a value lesser than 200 (maximum value) in the Maximum threads field.


Examples

Querying for Contacts in Salesforce Using Upstream Parameters in the Bulk Query Snap

The Salesforce Bulk Query Snap enables you to retrieve multiple data values from your Salesforce database using a simple query, where you can provide all the details associated with your request in the Snap. This Snap also enables you to use values derived from upstream Snaps. In this example, you query your Salesforce database for contact data using values from an upstream Snap. 

Download this Pipeline

Understanding the Pipeline

  1. Build the above Pipeline using the JSON Generator and Salesforce Bulk Query Snaps.

  2. Configure the JSON Generator Snap to send Contact as the type of data that you want to retrieve.


  3. Add the details associated with your bulk query request in the Salesforce Bulk Query Snap. This must include your account credentials.

    In this example, you are looking to receive the first and last names of the first five contacts in your Salesforce database.

  4. Save the Pipeline and validate it. Successful validation displays the data you requested.

Download this Pipeline.

Downloads


Related Content