> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce: Query

> Run a read-only SOQL SELECT query, for example Tasks, Events, Users, OpportunityContactRoles, or custom objects. Includes SDK V2 examples, schemas, and cost.

Run a read-only SOQL SELECT query, for example Tasks, Events, Users, OpportunityContactRoles, or custom objects.

<Info>
  Tool ID: `salesforce_query`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'salesforce_query',
  {
    "soql": "example"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute salesforce_query --input '{
  "soql": "example"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "records": [
      {}
    ],
    "done": true
  }
}
```

Use `deepline tools get salesforce_query --json` for the latest machine-readable contract.

## Input reference

Run one read-only SOQL query and return one page of records.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.soql` | `string` | Yes | — | Read-only SOQL SELECT statement, for example `SELECT Id, Subject, ActivityDate FROM Task WHERE WhoId = '00Q...'`. Only SELECT is allowed; FOR UPDATE is rejected. Minimum length: 1. Maximum length: 100000. |
| `payload.include_deleted` | `boolean` | No | — | Use queryAll to include deleted and archived records (IsDeleted = true). |
| `payload.next_records_url` | `string` | No | — | Salesforce `nextRecordsUrl` from a previous response. Pass it with the same `soql` to fetch the next page. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Run one read-only SOQL query and return one page of records.",
    "properties": {
      "soql": {
        "type": "string",
        "description": "Read-only SOQL SELECT statement, for example `SELECT Id, Subject, ActivityDate FROM Task WHERE WhoId = '00Q...'`. Only SELECT is allowed; FOR UPDATE is rejected.",
        "minLength": 1,
        "maxLength": 100000
      },
      "include_deleted": {
        "type": "boolean",
        "description": "Use queryAll to include deleted and archived records (IsDeleted = true)."
      },
      "next_records_url": {
        "type": "string",
        "description": "Salesforce `nextRecordsUrl` from a previous response. Pass it with the same `soql` to fetch the next page."
      }
    },
    "required": [
      "soql"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | Provider response payload. |
| `result.data.records` | `array` | Yes | — | — |
| `result.data.done` | `boolean` | Yes | — | — |
| `result.data.totalSize` | `integer` | No | — | Minimum: 0. |
| `result.data.nextRecordsUrl` | `string \| null` | No | — | — |
| `result.meta` | `record` | No | — | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Provider response payload.",
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One Salesforce record keyed by field API name, including `attributes.type`.",
              "additionalProperties": {}
            }
          },
          "done": {
            "type": "boolean"
          },
          "totalSize": {
            "type": "integer",
            "minimum": 0
          },
          "nextRecordsUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "records",
          "done"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": {}
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Salesforce provider guide](/docs/providers/salesforce/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.