> ## 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 query against Salesforce to read any object, such as tasks, events, users or custom objects. Includes SDK V2 examples, schemas, and cost.

Run a read-only SOQL query against Salesforce to read any object, such as tasks, events, users or custom objects.

> [!NOTE]
>
> Tool ID: `salesforce_query`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute salesforce_query --input '{
  "soql": "example"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "records": [
      {}
    ],
    "done": true
  }
}
```

Use `deepline describe 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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "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](https://deepline.com/docs/providers/salesforce/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


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