Loopfour
Integrations

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 idStudio labelWhat it does
salesforce.createRecordCreate RecordCreate a record of any object type.
salesforce.updateRecordUpdate RecordUpdate fields on a record.
salesforce.getRecordGet RecordRead a record, optionally only some fields.
salesforce.deleteRecordDelete RecordDelete a record.
salesforce.queryQuery Records (SOQL)Run a SOQL query.
salesforce.searchSearch Records (SOSL)Run a SOSL search.

Settings

The Studio fields:

FieldStudio labelTypeUsed byRequired for
connectionSalesforce Accountstring (connection id)AllOptional. Without it the step uses the company default connection for this system
objectTypeObject Typestring: Account, Contact, Lead, Opportunity, Case, Task, customcreateRecord, updateRecord, getRecord, deleteRecordAll
customObjectTypeCustom Object API Namestringcustom
recordIdRecord IDstringupdateRecord, getRecord, deleteRecord
fieldsFields (JSON)jsoncreateRecord, updateRecord
querySOQL Querystringquery
searchSOSL Searchstringsearch
propertiesProperties to RetrievestringgetRecord

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:

ActionFields read
createRecordsObjectType (API name, such as Opportunity or Invoice__c), data (object of field values)
updateRecordsObjectType, recordId, data
getRecordsObjectType, recordId, optional fields (array of field API names)
deleteRecordsObjectType, recordId
queryquery (SOQL string)
searchsearch (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/salesforce returns the actions and fields.
  • GET /api/v1/blocks/salesforce/actions/<operation>/examples returns 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 required or query is required.

On this page