Query Records (SOQL)
sf_query_recordsRun a SOQL query to retrieve matching records from Salesforce. Use it to read data, verify existing records before creating, or confirm changes, including aggregate results with GROUP BY.
Instructions
Executes a SOQL query against the org and returns matching records. Provide the full SOQL string in the query param. Use for reading data, checking existing records before creating, or verifying changes.
Supports aggregate queries — GROUP BY with COUNT(), SUM(), AVG(), MAX(), MIN(), e.g.: 'SELECT StageName, COUNT(Id), SUM(Amount) FROM Opportunity GROUP BY StageName' Aggregate results come back as regular records with the aggregate expressions as field keys (e.g. "expr0").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum records to return (default 200) | |
| query | Yes | Full SOQL query string, e.g. 'SELECT Id, Name FROM Account WHERE Industry = \'Technology\' LIMIT 10' |