Salesforce REST API

CRUD operations on Salesforce SObjects, composite batch operations, and SOSL search.

Output

SObject CRUD

FormatCrateDescription
JSONsalesforce_coreSalesforce API response. For create: includes id, success, errors. For get / get_by_external_id: the full record object. Record ID is set as event.id.

Composite

FormatCrateDescription
JSONsalesforce_coreArray of sub-request results, each with statusCode, result, and errors.

Search / Query

FormatCrateDescription
JSONsalesforce_coreSalesforce SOSL/SOQL response with searchRecords or records array.

SObject operations

Single-record operations: create, get, get_by_external_id, update, upsert, delete.

- salesforce_restapi_sobject:
    name: create_account
    operation: create
    credentials_path: /etc/salesforce/credentials.json
    sobject_type: Account
    payload:
      Name: "{{event.data.company_name}}"
      Industry: "Technology"

Fields

FieldTypeDefaultDescription
namestringrequiredTask name.
operationstringrequiredcreate, get, get_by_external_id, update, upsert, delete.
credentials_pathstringrequiredPath to Salesforce credentials.
sobject_typestringrequiredSObject type (e.g., Account, Contact).
payloadobjectRecord fields β€” explicit values or from_event: true.
record_idstringSalesforce record ID (for get, update, delete). Supports templating.
fieldsstringComma-separated field list (for get).
external_id_fieldstringExternal ID field name (for upsert, get_by_external_id).
external_id_valuestringExternal ID value. Supports templating.
depends_onlistUpstream task names.
retryobjectRetry configuration.

Examples

Upsert by external ID:

- salesforce_restapi_sobject:
    name: upsert_contact
    operation: upsert
    credentials_path: /etc/salesforce/credentials.json
    sobject_type: Contact
    external_id_field: External_Id__c
    external_id_value: "{{event.data.external_id}}"
    payload:
      FirstName: "{{event.data.first_name}}"
      LastName: "{{event.data.last_name}}"

Get a record:

- salesforce_restapi_sobject:
    name: get_account
    operation: get
    credentials_path: /etc/salesforce/credentials.json
    sobject_type: Account
    record_id: "{{event.data.account_id}}"
    fields: "Id,Name,Industry"

Composite operations

Batch operations on multiple records: create, get, update, upsert, delete, tree.

- salesforce_restapi_composite:
    name: bulk_create
    operation: create
    credentials_path: /etc/salesforce/credentials.json
    sobject_type: Account
    payload:
      from_event: true

Composite fields

FieldTypeDefaultDescription
namestringrequiredTask name.
operationstringrequiredcreate, get, update, upsert, delete, tree.
credentials_pathstringrequiredPath to Salesforce credentials.
sobject_typestringSObject type.
payloadobjectRecords β€” explicit list or from_event: true.
idslistRecord IDs (for get, delete).
fieldslistField list (for get).
external_id_fieldstringExternal ID field (for upsert).
all_or_noneboolAtomic transaction β€” all succeed or all fail.
depends_onlistUpstream task names.
retryobjectRetry configuration.

Execute SOSL queries to search across multiple objects simultaneously. Returns matching records as a JSON event.

- salesforce_restapi_search:
    name: find_accounts
    credentials_path: /etc/salesforce/credentials.json
    query: "FIND {Acme} IN ALL FIELDS RETURNING Account(Id, Name, Industry)"

Search fields

FieldTypeDefaultDescription
namestringrequiredTask name.
credentials_pathstringrequiredPath to Salesforce credentials.
querystringrequiredSOSL query string. Supports templating.
depends_onlistUpstream task names.
retryobjectRetry configuration.

Templating the search term

SOSL wraps the search term in curly braces (FIND {term} ...). Since Handlebars only treats double {{ as special, a single { is a literal character. This means {{{event.data.term}}} is parsed as literal { + {{event.data.term}} + literal }.

- salesforce_restapi_search:
    name: dynamic_search
    credentials_path: /etc/salesforce/credentials.json
    query: "FIND {{{event.data.search_term}}} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, FirstName, LastName, Email)"

Examples

Search with specific scope and field limits:

- salesforce_restapi_search:
    name: search_name_fields
    credentials_path: /etc/salesforce/credentials.json
    query: "FIND {Acme} IN NAME FIELDS RETURNING Account(Id, Name, Industry LIMIT 10), Contact(Id, FirstName, LastName LIMIT 5)"

Webhook-triggered search:

flow:
  name: salesforce_search
  tasks:
    - http_webhook:
        name: trigger
        method: POST
        endpoint: /search

    - salesforce_restapi_search:
        name: sosl_search
        credentials_path: $SALESFORCE_CREDENTIALS_PATH
        query: "FIND {{{event.data.term}}} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Email)"

    - log:
        name: log_results
        level: info
        structured: true