> **Building with AI coding agents?** If you're using an AI coding agent, install the official Scalekit plugin. It gives your agent full awareness of the Scalekit API — reducing hallucinations and enabling faster, more accurate code generation.
>
> - **Claude Code**: `/plugin marketplace add scalekit-inc/claude-code-authstack` then `/plugin install <auth-type>@scalekit-auth-stack`
> - **GitHub Copilot CLI**: `copilot plugin marketplace add scalekit-inc/github-copilot-authstack` then `copilot plugin install <auth-type>@scalekit-auth-stack`
> - **Codex**: run the bash installer, restart, then open Plugin Directory and enable `<auth-type>`
> - **Skills CLI** (Windsurf, Cline, 40+ agents): `npx skills add scalekit-inc/skills --list` then `--skill <skill-name>`
>
> `<auth-type>` / `<skill-name>`: `agentkit`, `full-stack-auth`, `mcp-auth`, `modular-sso`, `modular-scim` — [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Salesforce

**Authentication:** OAuth 2.0
**Categories:** Crm, Sales
## What you can do

Connect this agent connector to let your agent:

- **Read CRM records** — retrieve accounts, contacts, leads, opportunities, and cases by ID or search query
- **Create and update records** — open leads, close opportunities, update deal stages, and edit contacts
- **Log activities** — create tasks and events linked to any CRM record
- **Run SOQL queries** — execute arbitrary Salesforce Object Query Language queries for custom data retrieval
- **Search across objects** — find records by name, email, phone, or any field value
- **Call the Metadata API** — use [SOAP proxy calls](#call-the-metadata-api-through-soap-proxy) to inspect and modify Salesforce org metadata

## Authentication

This connector uses **OAuth 2.0**. Scalekit acts as the OAuth client: it redirects your user to Salesforce, obtains an access token, and automatically refreshes it before it expires. Your agent code never handles tokens directly — you only pass a `connectionName` and a user `identifier`.

You supply your Salesforce **Connected App** credentials (Client ID + Secret) once per environment in the Scalekit dashboard.

Before calling this connector from your code, create the Salesforce connection in **AgentKit** > **Connections** and copy the exact **Connection name** from that connection into your code. The value in code must match the dashboard exactly.

## Set up the connector

Register your Scalekit environment with the Salesforce connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. You'll need your app credentials from the [Salesforce Developer Console](https://developer.salesforce.com/).

1. ### Set up auth redirects

    - In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** > **Create Connection**.

    - Find **Salesforce** from the list of providers and click **Create**.

      > By default, a connection using Scalekit's credentials will be created. If you are testing, go directly to the next section. Before going to production, update your connection by following the steps below.

    - Copy the redirect URI. It looks like `https:///sso/v1/oauth//callback`.
    
      > Image: Copy redirect URI from Scalekit dashboard

    - Log in to [Salesforce](https://login.salesforce.com) and go to **Setup**.

    - In the Quick Find box, search for **App Manager** and click to open it.

    - Click **New Connected App**.

    - Enter a name for your app, check the **Enable OAuth Settings** checkbox, and paste the redirect URI in the **Callback URL** field.

      > Image: New Connected App form in Salesforce

    - Select the required OAuth scopes for your application.

2. ### Get client credentials

    - In your Connected App settings, note the following:
      - **Consumer Key** — listed under **OAuth Settings**
      - **Consumer Secret** — click **Reveal** to view and copy

3. ### Add credentials in Scalekit

    - In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** and open the connection you created.

    - Enter your credentials:
      - Client ID (Consumer Key from above)
      - Client Secret (Consumer Secret from above)
      - Permissions (scopes — see [Salesforce OAuth Scopes documentation](https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_scopes.htm&type=5))

      > Image: Add credentials in Scalekit dashboard
    - Click **Save**.

## Code examples

## Make your first call

Once a user authorizes the connection, make a request to Salesforce through the Scalekit proxy. The example below retrieves the authenticated user's profile — a useful sanity-check call.

> note: Path resolution
>
> Scalekit automatically prepends the user's Salesforce instance URL and API version (e.g. `https://mycompany.my.salesforce.com/services/data/v58.0`) — you only write the resource path.

  ### Node.js

```typescript

const connectionName = 'salesforce'  // name set in Scalekit dashboard
const identifier = 'user_123'        // your app's user ID

const scalekit = new ScalekitClient(
  process.env.SCALEKIT_ENV_URL,
  process.env.SCALEKIT_CLIENT_ID,
  process.env.SCALEKIT_CLIENT_SECRET,
)
const actions = scalekit.actions

const result = await actions.request({
  connectionName,
  identifier,
  method: 'GET',
  path: '/chatter/users/me',
})

console.log(result)
```

  ### Python

```python

from dotenv import load_dotenv
load_dotenv()

connection_name = "salesforce"  # name set in Scalekit dashboard
identifier = "user_123"         # your app's user ID

scalekit_client = scalekit.client.ScalekitClient(
    client_id=os.getenv("SCALEKIT_CLIENT_ID"),
    client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
    env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions

result = actions.request(
    connection_name=connection_name,
    identifier=identifier,
    method="GET",
    path="/chatter/users/me",
)
print(result)
```

## Common workflows

### Query records with SOQL

Retrieve this month's open opportunities, sorted by deal size:

  ### Node.js

```typescript
const result = await actions.request({
  connectionName,
  identifier,
  method: 'GET',
  path: '/query',
  params: {
    q: 'SELECT Id, Name, Amount, StageName, CloseDate FROM Opportunity WHERE CloseDate = THIS_MONTH ORDER BY Amount DESC LIMIT 10',
  },
})

console.log(result.records)
```

  ### Python

```python
result = actions.request(
    connection_name=connection_name,
    identifier=identifier,
    method="GET",
    path="/query",
    params={
        "q": "SELECT Id, Name, Amount, StageName, CloseDate FROM Opportunity WHERE CloseDate = THIS_MONTH ORDER BY Amount DESC LIMIT 10"
    },
)

print(result["records"])
```

### Log a sales call and advance a lead

Find a lead by email, update its status, then log a completed task — all in one agent turn.

This workflow uses Scalekit's [tool calling API](/agentkit/connectors/salesforce/#tool-list) (`execute_tool`), which maps directly to the tool names in the tool list below.

  ### Node.js

```typescript
// 1. Search for the lead
const searchResult = await actions.request({
  connectionName,
  identifier,
  method: 'GET',
  path: '/query',
  params: { q: "SELECT Id, Status FROM Lead WHERE Email = 'jane@acme.com' LIMIT 1" },
})
const lead = searchResult.records[0]

// 2. Update the lead status
await actions.request({
  connectionName,
  identifier,
  method: 'PATCH',
  path: `/sobjects/Lead/${lead.Id}`,
  body: { Status: 'Working - Contacted' },
})

// 3. Log a completed task linked to the lead
await actions.request({
  connectionName,
  identifier,
  method: 'POST',
  path: '/sobjects/Task',
  body: {
    WhoId: lead.Id,
    Subject: 'Discovery call — follow up in 3 days',
    Status: 'Completed',
    ActivityDate: '2025-04-10',
  },
})
```

  ### Python

```python
# Resolve the connected account to use execute_tool
response = actions.get_or_create_connected_account(
    connection_name=connection_name,
    identifier=identifier,
)
connected_account = response.connected_account

# 1. Find the lead by email
lead = actions.execute_tool(
    tool_name="salesforce_lead_search",
    connected_account_id=connected_account.id,
    tool_input={"query": "jane@acme.com"},
)

# 2. Update the lead status
actions.execute_tool(
    tool_name="salesforce_lead_update",
    connected_account_id=connected_account.id,
    tool_input={
        "lead_id": lead.result["Id"],
        "Status": "Working - Contacted",
    },
)

# 3. Log a completed task linked to the lead
actions.execute_tool(
    tool_name="salesforce_task_create",
    connected_account_id=connected_account.id,
    tool_input={
        "WhoId": lead.result["Id"],
        "Subject": "Discovery call — follow up in 3 days",
        "Status": "Completed",
        "ActivityDate": "2025-04-10",
    },
)
```

## Tool list

Use the exact tool names from the **Tool list** below when you call `execute_tool`. If you're not sure which name to use, list the tools available for the current user first.

## Tool list

### `salesforce_account_create`

Create a new Account in Salesforce. Supports standard fields

Parameters:

- `Name` (`string`, required): Account Name
- `AccountNumber` (`string`, optional): Account number for the organization
- `AnnualRevenue` (`number`, optional): Annual revenue
- `BillingCity` (`string`, optional): Billing city
- `BillingCountry` (`string`, optional): Billing country
- `BillingPostalCode` (`string`, optional): Billing postal code
- `BillingState` (`string`, optional): Billing state/province
- `BillingStreet` (`string`, optional): Billing street
- `Description` (`string`, optional): Description
- `Industry` (`string`, optional): Industry
- `NumberOfEmployees` (`integer`, optional): Number of employees
- `OwnerId` (`string`, optional): Record owner (User/Queue Id)
- `Phone` (`string`, optional): Main phone number
- `RecordTypeId` (`string`, optional): Record Type Id
- `Website` (`string`, optional): Website URL

### `salesforce_account_delete`

Delete an existing Account from Salesforce by account ID. This is a destructive operation that permanently removes the account record.

Parameters:

- `account_id` (`string`, required): ID of the account to delete

### `salesforce_account_get`

Retrieve details of a specific account from Salesforce by account ID. Returns account properties and associated data.

Parameters:

- `account_id` (`string`, required): ID of the account to retrieve
- `fields` (`string`, optional): Comma-separated list of fields to include in the response

### `salesforce_account_update`

Update an existing Account in Salesforce by account ID. Allows updating account properties like name, phone, website, industry, billing information, and more.

Parameters:

- `account_id` (`string`, required): ID of the account to update
- `AccountNumber` (`string`, optional): Account number for the organization
- `AccountSource` (`string`, optional): Lead source for this account
- `AnnualRevenue` (`number`, optional): Annual revenue
- `BillingCity` (`string`, optional): Billing city
- `BillingCountry` (`string`, optional): Billing country
- `BillingGeocodeAccuracy` (`string`, optional): Billing geocode accuracy
- `BillingLatitude` (`number`, optional): Billing address latitude
- `BillingLongitude` (`number`, optional): Billing address longitude
- `BillingPostalCode` (`string`, optional): Billing postal code
- `BillingState` (`string`, optional): Billing state/province
- `BillingStreet` (`string`, optional): Billing street
- `CleanStatus` (`string`, optional): Data.com clean status
- `Description` (`string`, optional): Description
- `DunsNumber` (`string`, optional): D-U-N-S Number
- `Fax` (`string`, optional): Fax number
- `Industry` (`string`, optional): Industry
- `Jigsaw` (`string`, optional): Data.com key
- `JigsawCompanyId` (`string`, optional): Jigsaw company ID
- `NaicsCode` (`string`, optional): NAICS code
- `NaicsDesc` (`string`, optional): NAICS description
- `Name` (`string`, optional): Account Name
- `NumberOfEmployees` (`integer`, optional): Number of employees
- `OwnerId` (`string`, optional): Record owner (User/Queue Id)
- `Ownership` (`string`, optional): Ownership type
- `ParentId` (`string`, optional): Parent Account Id
- `Phone` (`string`, optional): Main phone number
- `Rating` (`string`, optional): Account rating
- `RecordTypeId` (`string`, optional): Record Type Id
- `ShippingCity` (`string`, optional): Shipping city
- `ShippingCountry` (`string`, optional): Shipping country
- `ShippingGeocodeAccuracy` (`string`, optional): Shipping geocode accuracy
- `ShippingLatitude` (`number`, optional): Shipping address latitude
- `ShippingLongitude` (`number`, optional): Shipping address longitude
- `ShippingPostalCode` (`string`, optional): Shipping postal code
- `ShippingState` (`string`, optional): Shipping state/province
- `ShippingStreet` (`string`, optional): Shipping street
- `Sic` (`string`, optional): SIC code
- `SicDesc` (`string`, optional): SIC description
- `Site` (`string`, optional): Account site or location
- `TickerSymbol` (`string`, optional): Stock ticker symbol
- `Tradestyle` (`string`, optional): Trade style name
- `Type` (`string`, optional): Account type
- `Website` (`string`, optional): Website URL
- `YearStarted` (`string`, optional): Year the company started

### `salesforce_accounts_list`

Retrieve a list of accounts from Salesforce using a pre-built SOQL query. Returns basic account information.

Parameters:

- `limit` (`number`, required): Number of results to return per page

### `salesforce_chatter_comment_create`

Add a comment to a Salesforce Chatter post (feed element).

Parameters:

- `feed_element_id` (`string`, required): The ID of the Chatter post to comment on
- `text` (`string`, required): The text body of the comment

### `salesforce_chatter_comment_delete`

Delete a comment from a Salesforce Chatter post.

Parameters:

- `comment_id` (`string`, required): The ID of the Chatter comment to delete

### `salesforce_chatter_comments_list`

List all comments on a Salesforce Chatter post (feed element).

Parameters:

- `feed_element_id` (`string`, required): The ID of the Chatter post to list comments for
- `page` (`string`, optional): Page token for retrieving the next page of results
- `page_size` (`number`, optional): Number of comments to return per page (default: 25, max: 100)

### `salesforce_chatter_post_create`

Create a new post (feed element) on a Salesforce Chatter feed. Use 'me' as subject_id to post to the current user's feed.

Parameters:

- `text` (`string`, required): The text body of the Chatter post
- `is_rich_text` (`boolean`, optional): If true, the text body will be treated as HTML rich text. Default is false (plain text).
- `message_segments` (`array`, optional): Advanced: provide raw Salesforce message segments array for full rich text control (bold, italic, links, mentions, etc.). When provided, overrides 'text' and 'is_rich_text'. Each segment must have a 'type' field (Text, MarkupBegin, MarkupEnd, Mention, Link). MarkupBegin/End use markupType: Bold, Italic, Underline, Paragraph, etc.
- `subject_id` (`string`, optional): The ID of the subject (user, record, or group) to post to. Use 'me' for the current user's feed.

### `salesforce_chatter_post_delete`

Delete a Salesforce Chatter post (feed element) by its ID.

Parameters:

- `feed_element_id` (`string`, required): The ID of the Chatter post to delete

### `salesforce_chatter_post_get`

Retrieve a specific Salesforce Chatter post (feed element) by its ID.

Parameters:

- `feed_element_id` (`string`, required): The ID of the Chatter feed element (post) to retrieve.

### `salesforce_chatter_posts_search`

Search Salesforce Chatter posts (feed elements) by keyword across all feeds.

Parameters:

- `q` (`string`, required): Search query string to find matching Chatter posts
- `page` (`string`, optional): Page token for retrieving the next page of results
- `page_size` (`number`, optional): Number of results to return per page (default: 25, max: 100)

### `salesforce_chatter_user_feed_list`

Retrieve feed elements (posts) from a Salesforce user's Chatter news feed. Use 'me' as the user ID to get the current user's feed.

Parameters:

- `user_id` (`string`, required): The ID of the user whose Chatter feed to retrieve. Use 'me' for the current user.
- `page` (`string`, optional): Page token for retrieving the next page of results. Use the value from the previous response's nextPageToken.
- `page_size` (`number`, optional): Number of feed elements to return per page (default: 25, max: 100)
- `sort_param` (`string`, optional): Sort order for feed elements. Options: LastModifiedDateDesc (default), CreatedDateDesc, MostRecentActivity

### `salesforce_composite`

Execute multiple Salesforce REST API requests in a single call using the Composite API. Allows for efficient batch operations and related data retrieval.

Parameters:

- `composite_request` (`string`, required): JSON string containing composite request with multiple sub-requests

### `salesforce_contact_create`

Create a new contact in Salesforce. Allows setting contact properties like name, email, phone, account association, and other standard fields.

Parameters:

- `LastName` (`string`, required): Last name of the contact (required)
- `AccountId` (`string`, optional): Salesforce Account Id associated with this contact
- `Department` (`string`, optional): Department of the contact
- `Description` (`string`, optional): Free-form description
- `Email` (`string`, optional): Email address of the contact
- `FirstName` (`string`, optional): First name of the contact
- `LeadSource` (`string`, optional): Lead source for the contact
- `MailingCity` (`string`, optional): Mailing city
- `MailingCountry` (`string`, optional): Mailing country
- `MailingPostalCode` (`string`, optional): Mailing postal code
- `MailingState` (`string`, optional): Mailing state/province
- `MailingStreet` (`string`, optional): Mailing street
- `MobilePhone` (`string`, optional): Mobile phone of the contact
- `Phone` (`string`, optional): Phone number of the contact
- `Title` (`string`, optional): Job title of the contact

### `salesforce_contact_get`

Retrieve details of a specific contact from Salesforce by contact ID. Returns contact properties and associated data.

Parameters:

- `contact_id` (`string`, required): ID of the contact to retrieve
- `fields` (`string`, optional): Comma-separated list of fields to include in the response

### `salesforce_dashboard_clone`

Clone an existing dashboard in Salesforce. Creates a copy of the source dashboard in the specified folder.

Parameters:

- `folderId` (`string`, required): Folder to place the cloned dashboard
- `source_dashboard_id` (`string`, required): ID of the dashboard to clone
- `name` (`string`, optional): Name for the cloned dashboard

### `salesforce_dashboard_get`

Retrieve dashboard data and results from Salesforce by dashboard ID. Returns dashboard component data and results from all underlying reports.

Parameters:

- `dashboard_id` (`string`, required): ID of the dashboard to retrieve
- `filter1` (`string`, optional): First dashboard filter value (DashboardFilterOption ID)
- `filter2` (`string`, optional): Second dashboard filter value (DashboardFilterOption ID)
- `filter3` (`string`, optional): Third dashboard filter value (DashboardFilterOption ID)

### `salesforce_dashboard_metadata_get`

Retrieve metadata for a Salesforce dashboard, including dashboard components, filters, layout, and the running user.

Parameters:

- `dashboard_id` (`string`, required): The unique ID of the Salesforce dashboard

### `salesforce_dashboard_update`

Update a Salesforce dashboard. Supports renaming, moving to a folder, and saving sticky filters. Use GET dashboard first to find filter IDs.

Parameters:

- `dashboard_id` (`string`, required): ID of the dashboard to update
- `filters` (`array`, optional): Dashboard filters to save (array)
- `folderId` (`string`, optional): Folder to move the dashboard to
- `name` (`string`, optional): New name for the dashboard

### `salesforce_global_describe`

Retrieve metadata about all available SObjects in the Salesforce organization. Returns list of all objects with basic information.

### `salesforce_limits_get`

Retrieve organization limits information from Salesforce. Returns API usage limits, data storage limits, and other organizational constraints.

### `salesforce_object_describe`

Retrieve detailed metadata about a specific SObject in Salesforce. Returns fields, relationships, and other object metadata.

Parameters:

- `sobject` (`string`, required): SObject API name to describe

### `salesforce_opportunities_list`

Retrieve a list of opportunities from Salesforce using a pre-built SOQL query. Returns basic opportunity information.

Parameters:

- `limit` (`number`, optional): Number of results to return per page

### `salesforce_opportunity_create`

Create a new opportunity in Salesforce. Allows setting opportunity properties like name, amount, stage, close date, and account association.

Parameters:

- `CloseDate` (`string`, required): Expected close date (YYYY-MM-DD, required)
- `Name` (`string`, required): Opportunity name (required)
- `StageName` (`string`, required): Current sales stage (required)
- `AccountId` (`string`, optional): Associated Account Id
- `Amount` (`number`, optional): Opportunity amount
- `CampaignId` (`string`, optional): Related Campaign Id
- `Custom_Field__c` (`string`, optional): Example custom field (replace with your org’s custom field API name)
- `Description` (`string`, optional): Opportunity description
- `ForecastCategoryName` (`string`, optional): Forecast category name
- `LeadSource` (`string`, optional): Lead source
- `NextStep` (`string`, optional): Next step in the sales process
- `OwnerId` (`string`, optional): Record owner (User/Queue Id)
- `PricebookId` (`string`, optional): Associated Price Book Id
- `Probability` (`number`, optional): Probability percentage (0–100)
- `RecordTypeId` (`string`, optional): Record Type Id for Opportunity
- `Type` (`string`, optional): Opportunity type

### `salesforce_opportunity_get`

Retrieve details of a specific opportunity from Salesforce by opportunity ID. Returns opportunity properties and associated data.

Parameters:

- `opportunity_id` (`string`, required): ID of the opportunity to retrieve
- `fields` (`string`, optional): Comma-separated list of fields to include in the response

### `salesforce_opportunity_update`

Update an existing opportunity in Salesforce by opportunity ID. Allows updating opportunity properties like name, amount, stage, and close date.

Parameters:

- `opportunity_id` (`string`, required): ID of the opportunity to update
- `AccountId` (`string`, optional): Associated Account Id
- `Amount` (`number`, optional): Opportunity amount
- `CampaignId` (`string`, optional): Related Campaign Id
- `CloseDate` (`string`, optional): Expected close date (YYYY-MM-DD)
- `Description` (`string`, optional): Opportunity description
- `ForecastCategoryName` (`string`, optional): Forecast category name
- `LeadSource` (`string`, optional): Lead source
- `Name` (`string`, optional): Opportunity name
- `NextStep` (`string`, optional): Next step in the sales process
- `OwnerId` (`string`, optional): Record owner (User/Queue Id)
- `Pricebook2Id` (`string`, optional): Associated Price Book Id
- `Probability` (`number`, optional): Probability percentage (0–100)
- `RecordTypeId` (`string`, optional): Record Type Id for Opportunity
- `StageName` (`string`, optional): Current sales stage
- `Type` (`string`, optional): Opportunity type

### `salesforce_query_next_page`

Fetch the next page of results from a previous SOQL query. Use the nextRecordsUrl returned when a query response has done=false.

Parameters:

- `cursor` (`string`, required): The record cursor from a previous SOQL query response. Extract the cursor ID from the nextRecordsUrl (e.g. '01gxx0000002GJm-2000' from '/services/data/v66.0/query/01gxx0000002GJm-2000')

### `salesforce_query_soql`

Execute SOQL queries against Salesforce data. Supports complex queries with joins, filters, and aggregations.

Parameters:

- `query` (`string`, required): SOQL query string to execute

### `salesforce_report_create`

Create a new report in Salesforce using the Analytics API. Minimal verified version with only confirmed working fields.

Parameters:

- `name` (`string`, required): Report name
- `reportType` (`string`, required): The report type's API name from your Salesforce org (e.g. Opportunity, AccountList). Find valid values in Setup > Report Types
- `aggregates` (`string`, optional): Aggregates configuration (JSON array)
- `chart` (`string`, optional): Chart configuration (JSON object)
- `description` (`string`, optional): Report description
- `detailColumns` (`string`, optional): Detail columns (JSON array of field names)
- `folderId` (`string`, optional): Folder ID where report will be stored
- `groupingsAcross` (`string`, optional): Column groupings (JSON array)
- `groupingsDown` (`string`, optional): Row groupings (JSON array)
- `reportBooleanFilter` (`string`, optional): Filter logic
- `reportFilters` (`string`, optional): Report filters (JSON array)
- `reportFormat` (`string`, optional): Report format type. TABULAR (default, no groupings), SUMMARY (supports row groupings), or MATRIX (supports row and column groupings)
- `scope` (`string`, optional): Report scope. organization (all records) or team (current user's team records)

### `salesforce_report_delete`

Delete an existing report from Salesforce by report ID. This is a destructive operation that permanently removes the report and cannot be undone.

Parameters:

- `report_id` (`string`, required): ID of the report to delete

### `salesforce_report_metadata_get`

Retrieve report, report type, and related metadata for a Salesforce report. Returns information about report structure, fields, groupings, and configuration.

Parameters:

- `report_id` (`string`, required): The unique ID of the Salesforce report

### `salesforce_report_update`

Update an existing report in Salesforce by report ID. Minimal verified version with only confirmed working fields. Only updates fields that are provided.

Parameters:

- `report_id` (`string`, required): ID of the report to update
- `aggregates` (`string`, optional): Aggregates configuration (JSON array)
- `chart` (`string`, optional): Chart configuration (JSON object)
- `description` (`string`, optional): Updated report description
- `detailColumns` (`string`, optional): Detail columns (JSON array of field names)
- `folderId` (`string`, optional): Move report to different folder
- `groupingsAcross` (`string`, optional): Column groupings (JSON array)
- `groupingsDown` (`string`, optional): Row groupings (JSON array)
- `name` (`string`, optional): Updated report name
- `reportBooleanFilter` (`string`, optional): Filter logic
- `reportFilters` (`string`, optional): Report filters (JSON array)
- `reportFormat` (`string`, optional): Report format type. TABULAR (default, no groupings), SUMMARY (supports row groupings), or MATRIX (supports row and column groupings)
- `scope` (`string`, optional): Report scope. organization (all records) or team (current user's team records)

### `salesforce_search_parameterized`

Execute parameterized searches against Salesforce data. Provides simplified search interface with predefined parameters.

Parameters:

- `search_text` (`string`, required): Text to search for
- `sobject` (`string`, required): SObject type to search in
- `fields` (`string`, optional): Comma-separated list of fields to return

### `salesforce_search_sosl`

Execute SOSL searches against Salesforce data. Performs full-text search across multiple objects and fields.

Parameters:

- `search_query` (`string`, required): SOSL search query string to execute

### `salesforce_sobject_create`

Create a new record for any Salesforce SObject type (Account, Contact, Lead, Opportunity, custom objects, etc.). Provide the object type and fields as a dynamic object.

Parameters:

- `fields` (`object`, required): Object containing field names and values to set on the new record
- `sobject_type` (`string`, required): The Salesforce SObject API name (e.g., Account, Contact, Lead, CustomObject__c)

### `salesforce_sobject_delete`

Delete a record from any Salesforce SObject type by ID. This is a destructive operation that permanently removes the record.

Parameters:

- `record_id` (`string`, required): ID of the record to delete
- `sobject_type` (`string`, required): The Salesforce SObject API name (e.g., Account, Contact, Lead, CustomObject__c)

### `salesforce_sobject_get`

Retrieve a record from any Salesforce SObject type by ID. Optionally specify which fields to return.

Parameters:

- `record_id` (`string`, required): ID of the record to retrieve
- `sobject_type` (`string`, required): The Salesforce SObject API name (e.g., Account, Contact, Lead, CustomObject__c)
- `fields` (`string`, optional): Comma-separated list of fields to include in the response

### `salesforce_sobject_update`

Update an existing record for any Salesforce SObject type by ID. Only the fields provided will be updated.

Parameters:

- `fields` (`object`, required): Object containing field names and values to update on the record
- `record_id` (`string`, required): ID of the record to update
- `sobject_type` (`string`, required): The Salesforce SObject API name (e.g., Account, Contact, Lead, CustomObject__c)

### `salesforce_soql_execute`

Execute custom SOQL queries against Salesforce data. Supports complex queries with joins, filters, aggregations, and custom field selection.

Parameters:

- `soql_query` (`string`, required): SOQL query string to execute

### `salesforce_tooling_query_execute`

Execute SOQL queries against Salesforce Tooling API to access metadata objects like ApexClass, ApexTrigger, CustomObject, and development metadata. Use this for querying metadata rather than data objects.

Parameters:

- `soql_query` (`string`, required): SOQL query string to execute against Tooling API

### `salesforce_tooling_sobject_create`

Create a new metadata record for any Salesforce Tooling API object type (ApexClass, ApexTrigger, CustomField, etc.). Supports both simple and nested field structures. For CustomField, use FullName and Metadata properties.

Parameters:

- `fields` (`object`, required): Object containing field names and values to set on the new metadata record. Supports nested structures for complex metadata types.
- `sobject_type` (`string`, required): The Tooling API object name (e.g., ApexClass, ApexTrigger, CustomObject)

### `salesforce_tooling_sobject_delete`

Delete a metadata record from any Salesforce Tooling API object type by ID. This is a destructive operation that permanently removes the metadata.

Parameters:

- `record_id` (`string`, required): ID of the metadata record to delete
- `sobject_type` (`string`, required): The Tooling API object name (e.g., ApexClass, ApexTrigger, CustomObject)

### `salesforce_tooling_sobject_describe`

Retrieve detailed metadata schema for a specific Tooling API object type. Returns fields, relationships, and other metadata properties.

Parameters:

- `sobject` (`string`, required): Tooling API object name to describe

### `salesforce_tooling_sobject_get`

Retrieve a metadata record from any Salesforce Tooling API object type by ID. Optionally specify which fields to return.

Parameters:

- `record_id` (`string`, required): ID of the metadata record to retrieve
- `sobject_type` (`string`, required): The Tooling API object name (e.g., ApexClass, ApexTrigger, CustomObject)
- `fields` (`string`, optional): Comma-separated list of fields to include in the response

### `salesforce_tooling_sobject_update`

Update an existing metadata record for any Salesforce Tooling API object type by ID. Supports both simple and nested field structures. Only the fields provided will be updated.

Parameters:

- `fields` (`object`, required): Object containing field names and values to update on the metadata record. Supports nested structures for complex metadata types.
- `record_id` (`string`, required): ID of the metadata record to update
- `sobject_type` (`string`, required): The Tooling API object name (e.g., ApexClass, ApexTrigger, CustomObject)

## Call the Metadata API through SOAP proxy

export const sectionTitle = 'Call the Metadata API through SOAP proxy'

The [Salesforce Metadata API](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_intro.htm) is a SOAP-based API for reading and modifying your Salesforce org's configuration, not its data. Use it to inspect or deploy custom objects, page layouts, validation rules, Apex classes, permission sets, profiles, and other org metadata.

Salesforce SOAP APIs only accept opaque access tokens, not JSON Web Token (JWT) access tokens. In your Salesforce Connected App, make sure **Issue JSON Web Token (JWT)-based access tokens for named users** is unchecked. If you disable this option after users have already authenticated, users must re-authenticate before SOAP proxy calls work.

### Get the API version for the connected account

The Metadata API SOAP endpoint URL requires a version number. Retrieve the version from the connected account's `api_config`.

```python collapse={1-15}

from dotenv import load_dotenv

load_dotenv()

connection_name = "salesforce"  # Connection name from the Scalekit dashboard
identifier = "6fe1c057-f684-4303-9555-3dd8807319b4"  # Your user's identifier as registered in Scalekit

scalekit_client = scalekit.client.ScalekitClient(
    client_id=os.getenv("SCALEKIT_CLIENT_ID"),
    client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
    env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions

result = actions.get_connected_account(
    connection_name=connection_name,
    identifier=identifier,
)

raw_version = result.connected_account.api_config.get("version")
if not raw_version:
    raise ValueError("Salesforce connected account is missing api_config.version")

api_version = raw_version.lstrip("v")  # e.g. "66.0"
```

1. ## Build the SOAP body

   Construct the SOAP envelope for the operation you want to call. Do not include a `` element. Scalekit injects the session header with the connected account's access token.

   The `soap_body` string uses the `api_version` value from the previous section.

   ```python
   soap_body = f"""<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:met="http://soap.sforce.com/2006/04/metadata">
     <soapenv:Body>
       <met:describeMetadata>
         <met:asOfVersion>{api_version}</met:asOfVersion>
       </met:describeMetadata>
     </soapenv:Body>
   </soapenv:Envelope>"""
   ```

2. ## Send the SOAP request through Scalekit

   Pass the SOAP body as `raw_body`. Set `Content-Type` to `text/xml; charset=UTF-8` and `SOAPAction` to the operation name. Scalekit resolves the user's Salesforce instance URL, so the request only needs the Metadata API path.

   ```python
   try:
       response = actions.request(
           connection_name=connection_name,
           identifier=identifier,
           path=f"/services/Soap/m/{api_version}",
           method="POST",
           raw_body=soap_body,
           headers={
               "Content-Type": "text/xml; charset=UTF-8",
               "SOAPAction": "describeMetadata",
           },
       )
   except Exception as exc:
       raise RuntimeError("Salesforce Metadata API SOAP proxy request failed") from exc

   print(response.content)
   ```

> note: Exclusive availability
>
> SOAP proxy support is available on the **Enterprise plan** and is limited to the Salesforce
> Metadata API. To enable it for your workspace, contact
> [support@scalekit.com](mailto:support@scalekit.com).


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
