step

salesforce

Integrate with Salesforce CRM to query, create, update, upsert, and delete records.

Overview

Integrate with Salesforce CRM to query, create, update, upsert, and delete records. This step provides a complete interface to Salesforce using username-password authentication. It supports all major CRUD operations with template substitution for dynamic queries and data. Authentication uses username + password + security_token. The password and security token can be concatenated or provided separately. Operations: - query: Execute SOQL queries to retrieve records - create: Create new records in Salesforce - update: Update existing records by ID - upsert: Insert or update records based on external ID - delete: Delete records by ID

Quick Start

steps:
- type: salesforce
  operation: query
  password: MyPassword123
  security_token: abc123xyz789
  username: admin@company.com

Configuration

Parameter Type Required Description
username string Yes Salesforce username (email address)
password string Yes Salesforce password. Can be password+security_token concatenated, or just password if security_token is separate.
security_token string Yes Salesforce security token. Get this from Setup → Reset My Security Token.
domain string No Salesforce domain. Use 'login' for production, 'test' for sandbox environments.
Default: "login"
Options: [object Object], [object Object]
operation string Yes Operation to perform: query (SOQL), create (new record), update (by ID), upsert (by external ID), delete (by ID).
Options: [object Object], [object Object], [object Object], [object Object], [object Object]
api_version string No Salesforce API version to use. If not specified, uses the latest version.
sobject string No Salesforce object type (e.g., 'Account', 'Contact', 'Lead'). Required for create, update, upsert, delete operations.
query string No SOQL query string. Required for 'query' operation. Supports ${path.to.key} template substitution.
record_id_path string No Dot-separated path to Salesforce record ID in event. Required for update and delete operations.
external_id_field string No External ID field name for upsert operation. This field must be marked as External ID in Salesforce.
input_from string No Dot-separated path to data in event for create, update, or upsert operations.
data_path string No DEPRECATED: Use 'input_from' instead. Dot-separated path to data in event.
output_to string No Event key where query results will be stored. Used for query operation.
output_key string No DEPRECATED: Use 'output_to' instead. Event key for query results.
drop_on_failure boolean No If True, return None on errors instead of injecting error details into event.
Default: false
timeout integer No Timeout in seconds for Salesforce API requests (default 30).
Default: 30
inject string No Event key used to store operation results or error metadata.
Default: "salesforce"

Examples

Query contacts by email

Search for contact records matching a specific email address

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
operation: query
query: "SELECT Id, Name, Email, Phone FROM Contact WHERE Email = '${user.email}'"
output_to: salesforce_contacts

Create new lead from form submission

Create a new lead record from incoming web form data

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
operation: create
sobject: Lead
data:
  FirstName: ${form.first_name}
  LastName: ${form.last_name}
  Email: ${form.email}
  Company: ${form.company}
  Status: Open - Not Contacted
  LeadSource: Website
output_to: new_lead

Update opportunity stage

Mark an opportunity as won and set close date

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
operation: update
sobject: Opportunity
record_id: ${opportunity.salesforce_id}
data:
  StageName: Closed Won
  CloseDate: ${deal.close_date}
  Amount: ${deal.final_amount}
output_to: updated_opportunity

Upsert account by external ID

Create or update account based on external CRM ID

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
operation: upsert
sobject: Account
external_id_field: External_CRM_ID__c
external_id: ${account.crm_id}
data:
  Name: ${account.company_name}
  Industry: ${account.industry}
  Phone: ${account.phone}
  BillingCity: ${account.city}
inject: upserted_account

Query recent opportunities

Get all opportunities created in the last 30 days

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
domain: login
operation: query
query: "SELECT Id, Name, StageName, Amount, CloseDate FROM Opportunity WHERE CreatedDate = LAST_N_DAYS:30 ORDER BY CreatedDate DESC"
inject: recent_opportunities

Create case from support ticket

Create a Salesforce case when a support ticket is received

type: salesforce
username: ${env:sf_username}
password: ${env:sf_password}
security_token: ${env:sf_security_token}
operation: create
sobject: Case
data:
  Subject: ${ticket.subject}
  Description: ${ticket.description}
  Priority: ${ticket.priority}
  Status: New
  Origin: Web
  ContactId: ${ticket.contact_salesforce_id}
inject: created_case

Advanced Options

These options are available on all steps for error handling and retry logic:

Parameter Type Default Description
retries integer 0 Number of retry attempts (0-10)
backoff_seconds number 0 Backoff (seconds) applied between retry attempts
retry_propagate boolean false If True, raise last exception after exhausting retries; otherwise swallow.