Salesforce connector
The Salesforce connector is an outbound protocol connector that allows you to connect your BPMN service with Salesforce to interact with the Salesforce APIs.
Prerequisites
To use the Salesforce connector, you must have a Salesforce Connected App with OAuth 2.0 Client Credentials Flow.
Use secrets to avoid exposing your Salesforce Connected App client ID and client secret as plain text. Learn more in our documentation on managing secrets.
Create a Salesforce connector task
You can apply a connector to a task or event via the append menu. For example:
- From the canvas: Select an element and click the Change element icon to change an existing element, or use the append feature to add a new element to the diagram.
- From the properties panel: Navigate to the Template section and click Select.
- From the side palette: Click the Create element icon.
In each of these menus, you can search by connector name or by the operation you want to perform, such as upload object or send email. Connectors that provide several operations list them as separate entries, and selecting an operation applies the connector with that operation preselected.
After you have applied a connector to your element, follow the configuration steps or see using connectors to learn more.
Instance
Each operation requires information about the Salesforce Base URL.
Example: https://MyDomainName.my.salesforce.com
The Salesforce API version should be the one you want to use. You can search for this information in your Salesforce API.
Authentication
In the Authentication section, select Bearer Token to provide a static access token or OAuth 2.0 to configure client credentials.
While the static access token is useful for getting started, it is recommended to provide the OAuth 2.0 client credentials.
Operation
Operation types
This connector supports the following operation types:
SOQL Query
The SOQL Query only requires the query itself as input. A query is useful for receiving data based on a structured query language. Take a closer look at some available examples.
The response body looks like the following:
{
"totalSize": 1,
"done": true,
"records": [
{
"attributes": {
"type": "<object>",
"url": "/services/data/<API version>/sobjects/<object>/<object id>"
},
"<queried field name>": "<field value>",
"...": "..."
}
]
}
sObject records
sObject records support Create record, Get record, Update record, and Delete record.
Every operation explanation contains a link to the Salesforce API docs which will explain the request and provide an example.
Create record
- Salesforce object: The Salesforce object to create, e.g. Account.
- Record fields: Field values for the Salesforce object to create, e.g.
{ Name: "Express Logistics and Transport" }.
Review an example including the response body format in the Salesforce documentation.
Get record
- Salesforce object: The Salesforce object to create, e.g. Account.
- Salesforce object ID: Identifier of the Salesforce object, e.g. 001R0000005hDFYIA2.
- Relationship field name (optional): Name of the field that contains the relationship, e.g. Opportunities.
- Query Parameters (optional): Additional query parameters that can be provided along with the request, e.g.
{ fields: "AccountNumber,BillingPostalCode" }.
When omitting the Relationship field name, a get request for a record is performed. Otherwise, a get request for records using sObject relationships is performed. In the documentation linked above, you can find the possible use case for Query parameters; for example, filtering fields.
The response body will contain the requested object as the root object:
{
"attributes": {
"type": "<object>",
"url": "/services/data/<API version>/sobjects/<object>/<object id>"
},
"<field name>": "<field value>",
"...": "..."
}
Find another example here.
Update object
- Salesforce object: The Salesforce object to create, e.g. Account.
- Salesforce object ID: Identifier of the Salesforce object, e.g. 001R0000005hDFYIA2.
- Record fields: Field values for the Salesforce object to update, e.g.
{ BillingCity : "San Francisco" }.
These update the record using the given fields.
As an update does not return a body, you will not be able to map any data from the response back to the process.
Delete object
- Salesforce object: The Salesforce object to create, e.g. Account.
- Salesforce object ID: Identifier of the Salesforce object, e.g. 001R0000005hDFYIA2.
As a delete does not return a body, you will not be able to map any data from the response back to the process.
Apex REST
Use Apex REST to invoke a custom Apex REST endpoint.
- Method: The HTTP method of the request:
GET(default),POST,PATCH,DELETE, orPUT. - Path: The path appended to
/services/apexrest/to build the request URL, for example,MyApexClassorMyApexClass/action. - Request body: (Optional) The request payload for the Apex REST call, provided as a FEEL context. This field is available for the
POST,PATCH, andPUTmethods.
Composite Request
Use Composite Request to batch any combination of Salesforce REST API calls into a single request. The connector sends the request to /services/data/<Salesforce API version>/composite.
- All or none: Roll back all subrequests if any of them fails. If disabled, subrequests are processed independently. Enabled by default.
- Collate subrequests: Batch compatible subrequests together where possible. Disabled by default.
- Subrequests: A FEEL list of subrequests, each a context with
method,url,referenceId, and optionalbodyentries. To reference an earlier subrequest's result in a later subrequest'surlorbody, use itsreferenceId. See the Composite API reference.
Handle connector response
The Salesforce connector is a protocol connector, meaning it is built on top of the HTTP REST connector. Therefore, handling response is still applicable as described.