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 Camunda 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
A Connector can be applied to a task or an event using the append menu. Access the append menu using any of the three methods below:
- 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.
Once you have applied a Connector to your element, follow the configuration steps or read our guide on 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
Currently, this Connector supports two types of operation:
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.
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.