> ## 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.

# Summarize Records

> Counts and sums grouped by a field and/or a calendar or fiscal time bucket.

`salesforce_summarize_records`

Answers "how many" / "how much" questions. Group by a field, a time bucket, or both, with optional filters that match [`salesforce_find_records_smart`](/connectors/Salesforce/find-records-smart).

To list the records themselves, use find. To learn valid field names, use [`salesforce_explore_schema`](/connectors/Salesforce/explore-schema).

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `object` | string | Yes | Object label or API name. |
| `group_by` | string | No | A groupable field (label or API name). |
| `time_bucket` | `"day"` \| `"week"` \| `"month"` \| `"quarter"` \| `"year"` \| `"fiscal_quarter"` \| `"fiscal_year"` | No | Bucket records over `bucket_field`. |
| `bucket_field` | string | No | Date/datetime field for `time_bucket`. Default: `CloseDate` on Opportunity, otherwise `CreatedDate`. |
| `metric_field` | string | No | Numeric field to sum / avg / min / max. Required for those metrics. |
| `metrics` | array of `"count"` \| `"sum"` \| `"avg"` \| `"min"` \| `"max"` | No | Default: `["count"]`, or `["count","sum"]` when `metric_field` is set. |
| `name_contains` | string | No | Substring of the record's name field. |
| `field_equals` | object | No | Exact-match filters (labels or API names). |
| `owner` | string | No | `"me"`, a name, or a User id. |
| `date_field` | `"modified"` \| `"created"` | No | Timestamp for the date range. |
| `date_from` | string | No | Inclusive lower bound, `YYYY-MM-DD`. |
| `date_to` | string | No | Inclusive upper bound, `YYYY-MM-DD`. |
| `top` | number (1–50) | No | Max groups to return. Default: `20`. |
| `sort` | `"metric_desc"` \| `"metric_asc"` \| `"group_asc"` | No | Default: `metric_desc` (`group_asc` when `time_bucket` is set). |
| `response_format` | `"markdown"` \| `"json"` | No | Default: `"markdown"`. |

## Returns

Grouped rows with metrics and a grand total. Structured data includes the grouping keys and numeric values.

## Example use

> "How many open Opportunities do we have by stage?"

> "Sum Amount for my Opportunities closing this quarter, by month."
