Salesforce actions
Reference for the Salesforce actions: the sign-in connection, each action id, the fields each executor reads, outputs, and a complete query example.
The Salesforce block runs SOQL queries, SOSL searches and record reads and writes against a Salesforce org through the REST API (v59.0). For the plain-language guide, see Salesforce.
When to use it
Use it to pull opportunities and accounts into billing or revenue workflows, and to write invoice references back to Salesforce. There is no Salesforce trigger block.
Connection
- Provider id:
salesforce. Sign-in (OAuth) connection. The step acts as the user who connected. - Pin an account with
config.connection. Without it, the step uses the company's default Salesforce connection.
Actions
| Action id | Studio label | What it does |
|---|---|---|
salesforce.createRecord | Create Record | Create a record of any object type. |
salesforce.updateRecord | Update Record | Update fields on a record. |
salesforce.getRecord | Get Record | Read a record, optionally only some fields. |
salesforce.deleteRecord | Delete Record | Delete a record. |
salesforce.query | Query Records (SOQL) | Run a SOQL query. |
salesforce.search | Search Records (SOSL) | Run a SOSL search. |
Settings
The Studio fields:
| Field | Studio label | Type | Used by | Required for |
|---|---|---|---|---|
connection | Salesforce Account | string (connection id) | All | Optional. Without it the step uses the company default connection for this system |
objectType | Object Type | string: Account, Contact, Lead, Opportunity, Case, Task, custom | createRecord, updateRecord, getRecord, deleteRecord | All |
customObjectType | Custom Object API Name | string | custom | |
recordId | Record ID | string | updateRecord, getRecord, deleteRecord | |
fields | Fields (JSON) | json | createRecord, updateRecord | |
query | SOQL Query | string | query | |
search | SOSL Search | string | search | |
properties | Properties to Retrieve | string | getRecord |
Fields each action reads
The record executors read different keys from the Studio fields above. objectType, customObjectType and fields (on create and update) and properties are not read, so record steps built only in Studio fail with sObjectType is required. Set these keys in the workflow definition:
| Action | Fields read |
|---|---|
createRecord | sObjectType (API name, such as Opportunity or Invoice__c), data (object of field values) |
updateRecord | sObjectType, recordId, data |
getRecord | sObjectType, recordId, optional fields (array of field API names) |
deleteRecord | sObjectType, recordId |
query | query (SOQL string) |
search | search (SOSL string) |
Output
The step output is the Salesforce response. query returns records, totalSize and done; createRecord returns the new id; getRecord returns the record's fields. For example {{steps.won_deals.records}}.
Example
List this month's closed-won opportunities, then write an invoice number back to one of them.
{
"name": "Closed-won opportunities",
"trigger": { "type": "api" },
"steps": [
{
"id": "won_deals",
"type": "action",
"name": "Find closed-won opportunities",
"action": "salesforce.query",
"config": {
"query": "SELECT Id, Name, Amount, CloseDate, AccountId FROM Opportunity WHERE StageName = 'Closed Won' AND CloseDate = THIS_MONTH"
}
},
{
"id": "write_back",
"type": "action",
"name": "Record the invoice number",
"action": "salesforce.updateRecord",
"config": {
"sObjectType": "Opportunity",
"recordId": "{{input.opportunityId}}",
"data": { "Invoice_Number__c": "{{input.invoiceNumber}}" }
}
}
]
}Other executors
The Salesforce module also has object-specific executors that the block does not list, such as salesforce.getOpportunity, salesforce.closeOpportunity and salesforce.listAccounts. The workflow validator accepts only the operations in the table above, so use those.
Live catalog
GET /api/v1/blocks/salesforcereturns the actions and fields.GET /api/v1/blocks/salesforce/actions/<operation>/examplesreturns stored examples where they exist.
Errors and limits
- A Salesforce API error fails the step.
- A missing required key fails the step before Salesforce is called, for example
sObjectType is required,data is requiredorquery is required.
Sage Intacct actions
Reference for the Sage Intacct actions: the connection type, each action and what it does, its inputs and outputs, and the live catalog call.
Slack actions
Reference for the Slack actions: the workspace connection, each action id, the fields each executor reads, file upload limits, outputs and an example.
Loopfour