Short Description
SalesforceReader Attributes
See also

Short Description

SalesforceReader reads records from Salesforce using SOAP API.

[Note]Which Salesforce reader?

If you need to read a small number of records, read attachments or use functions and subqueries, use SalesforceReader.

If you need to read a large number of records, use SalesforceBulkReader.

Component Data source Input ports Output ports Each to all outputs Different to different outputs Transformation Transf. req. Java CTL Auto-propagated metadata


Port typeNumberRequiredDescriptionMetadata
SOQL query resultsoutput0


SalesforceReader does not propagate metadata.

SalesforceReader has no metadata templates.

SalesforceReader has no special requirements on metadata names or field data types.

SalesforceReader Attributes

AttributeReqDescriptionPossible values

A Salesforce connection. See Salesforce connection.

e.g. MySFConnection
SOQL queryyes

A query for retrieving data from Salesforce.

The component allows you to use subset of the SOQL language.

If you query the records, you should use API names for objects and fields. The API name can differ from the name of an object in Salesforce web GUI.

You can use graph parameters in SOQL query.

e.g. SELECT Name, Website FROM Account WHERE Industry = 'Energy'
Output mapping Mapping from query fields to output metadata fieldsMap by name (default)
Read mode 

Defines in what way records are read from Salesforce. You can enable reading deleted records, and then such records will be returned by the component. To distinguish deleted and not deleted records, query the isDeleted field. For an example, see Reading deleted records details and Reading deleted records.

Do not return deleted or archived records (default) | Return also deleted or archived records


SalesforceReader reads records from Salesforce using SOAP API, which performs the operations synchronously making it suitable for retrieving small datasets.

To use the component, create a Salesforce connection, enter an SOQL query and specify the output mapping. If you perform the steps in this order, the transform editor can provide you with metadata extracted from the SOQL query. Therefore, you will be able to map the fields with drag and drop.


SalesforceReader uses Salesforce Object Query Language (SOQL) to query data in Salesforce.

List of Supported SOQL Functions

Due to different implementation of almost each function in API, we support the following functions.

Aggregate Functions
Date functions
Misc functions
Aggregate Functions

The table shows returned data type for particular argument data type.

FunctionParameter type

[a] Decimal with 'maximal' precision and scale is used (decimal[64, 32])

[b] Precision and scale are derived from the first function parameter.

[c] Scale is derived from the first function parameter and precision is fixed to 64.

See also the Salesforce documentation on Aggregate Functions.

Date functions
FunctionResult typeNote

Must be used in a date function. For example HOUR_IN_DAY(convertTimezone(CreatedDate))

See also documentation on convertTimezone()

See also Salesforce documentation on Date Functions.

Misc functions
FunctionResult typeNote
convertCurrency()Decimal [a] convertCurrency()
distance()Decimal [b]Location-Based SOQL Queries
toLabel()StringTranslating Results

[a] decimal[64, 6]

[b] Decimal with 'maximal' precision and scale is used (decimal[64, 32]))

Subqueries and Join Type

When the SOQL query contains a subquery, LEFT OUTER JOIN is performed to provide flat data structure. If no records have been returned by the subquery, null values are returned for subquery fields.

For example, if you select opportunities in a subquery and an account from a root query has no opportunity, a single record with null subquery fields is returned for this account. If the account has multiple opportunities, multiple records are produced.

Order of Output Records

The output records come out in arbitrary order unless you use ORDER BY in your query.

SOAP or Bulk API

If you read less than 10-15,000 records, it is generally better to use SOAP API because it will use less API requests.

Notes and Limitations

Address and Geolocation Compound Fields

Compound fields group together several fields to represent a complex data type, such as addresses or locations. SalesforceReader does not support reading compound fields as a whole, you need to read their separate parts. The dialog for defining SOQL shows the individual fields of compound fields, e.g. BillingStreet, BillingCity, etc.

For example, to read BillingAddress it is not possible to use the following SOQL:

SELECT BillingAddress FROM Account

Instead you need to read its individual component fields:

SELECT BillingStreet, BillingCity, BillingPostalCode FROM Account

See Compound Fields.

Aggregate functions

In subqueries, you cannot read data from binary fields or use aggregate functions. This is a limitation of the SOAP API.

Reading deleted records details

When a Salesforce record is deleted it is first moved to Recycle Bin, from where it can be restored. Then automatically after a time interval, or after manually emptying the Recycle Bin, the record will be marked to be permanently deleted. Records marked to be permanently deleted cannot be restored, and are wiped from the database automatically by a background process.

If a record is deleted using the Hard Delete operation, it skips the Recycle Bin and is immediately ready to be permanently deleted.

Reading deleted records returns records which are not wiped yet, including those that are not in the Recycle Bin anymore but were not permanently deleted yet.

API Requests

SalesforceReader uses multiple API calls during its run. All of them count towards your Salesforce API request limit. The precise call flow is:

  1. Login

  2. Extract metadata of an expected result of a query. The number of requests depends on complexity of the query. In general, every unique Salesforce object used in the query will result in 1 API request.

  3. Send the query and iterate over the result. An API request must be sent for every 2,000 returned records, so the number of requests depends on the number of records in the result. This is a limitation of the SOAP API.


Reading records from Salesforce
Query on multiple objects (tables)
Query on multiple objects (tables) II
Using aggregate functions
Reading deleted records

Reading records from Salesforce

This example shows the basic functionality of SalesforceReader.

Select FirstName, LastName and Email from Contact.


Create a Salesforce connection.

In SalesforceReader, set up the Connection, SOQL query and Output mapping parameters.

ConnectionConnection from the first step
SOQL querySELECT FirstName, LastName, Email FROM Contact
Output mapping


function integer transform() {
 	$out.0.Email = $in.0.Email;
 	$out.0.FirstName = $in.0.FirstName;
 	$out.0.LastName = $in.0.LastName;

 	return ALL;

Query on multiple objects (tables)

This example shows the way to query records from two objects (tables) with a parent-child relationship. The solution of this example and the following ones shows only the SOQL query as the rest of the configuration has already been shown in the first example.

Select an account name and corresponding parent account name from Account.


SELECT Name, Parent.Name FROM Account

Query on multiple objects (tables) II

Select an account name and details of corresponding opportunities: name, type, amount, description.


SELECT Account.Name, (SELECT Opportunity.Name, Opportunity.Type, Opportunity.Amount, Opportunity.Description FROM Opportunities) FROM Account

Using aggregate functions

This example shows the way to use Salesforce aggregate functions.

Select account names and for each account count the sum from opportunities we won. The result should be sorted according to the sum in descending order.


SELECT Account.Name, SUM(Amount) FROM Opportunity WHERE IsWon = true GROUP BY Account.Name ORDER BY SUM(Amount) DESC

Reading deleted records

This example shows how to read deleted records. For more details on how records are deleted in Salesforce, see Reading deleted records details. Reading deleted records can be used for backup or for synchronization with a data warehouse where you need to mirror the delete operations.


Set the SalesforceReader attribute Read mode to Return also deleted or archived records.

Read the records and their IsDeleted field to distinguish deleted and not deleted records:

SELECT Name, IsDeleted FROM Account


VersionCompatibility Notice

SalesforceReader is available since 4.4.0-M2. It uses Salesforce SOAP API version 37.0.

4.5.0-M2SalesforceReader uses Salesforce SOAP API version 39.0.

See also

Common Properties of Components
Specific Attribute Types
Common Properties of Readers
Readers Comparison
Salesforce connection
Extracting Metadata from Salesforce