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

# Query (SOQL fallback)

> Last-resort read-only SOQL. Use only when find, summarize, or overview cannot express the question.

`salesforce_query`

Last resort. Use only when [`salesforce_find_records_smart`](/connectors/Salesforce/find-records-smart), [`salesforce_summarize_records`](/connectors/Salesforce/summarize-records), or [`salesforce_get_record_overview`](/connectors/Salesforce/get-record-overview) cannot express the question (for example multi-field `GROUP BY`, `HAVING`, or semi-joins).

Call [`salesforce_explore_schema`](/connectors/Salesforce/explore-schema) first for exact object and field API names.

<Warning>
  **SELECT only.** The statement runs exactly as written — DeepMask does not rewrite it, add fields, or follow `nextRecordsUrl`. One page per call. There is no write or delete via this action.
</Warning>

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `soql` | string | Yes | A complete SOQL `SELECT`. Runs verbatim. |
| `limit` | number (1–200) | No | Maximum rows of the first page to return. Default: `50`. |
| `response_format` | `"markdown"` \| `"json"` | No | Default: `"markdown"`. |

## Returns

One page of rows. Structured data includes full ids and each row's `web_url`. Add filters or a `LIMIT` in the SOQL for large results.

## Example use

> "Run this SOQL: select StageName, count(Id) from Opportunity where IsClosed = false group by StageName having count(Id) > 5"
