customFieldBreakdown
Requires permission analytics:sales:read.
Quotes, orders or invoices over a date range counted and valued by one of your choice or yes/no custom fields (the document's or its customer's), optionally filtered on such fields, limited to what your role may see: sales reps see their own records, admins see everything by default, and other staff see their team. Only fields placed on list filters that you may see. Needs the sales analytics read permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query CustomFieldBreakdown($input: CustomFieldBreakdownInput!, $range: AnalyticsRangeInput!) {
customFieldBreakdown(input: $input, range: $range) {
fieldType
groupByKey
groupByOwner
record
scope
totalAmount
groups {
amount
count
label
value
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query CustomFieldBreakdown($input: CustomFieldBreakdownInput!, $range: AnalyticsRangeInput!) {\n customFieldBreakdown(input: $input, range: $range) {\n fieldType\n groupByKey\n groupByOwner\n record\n scope\n totalAmount\n groups {\n amount\n count\n label\n value\n }\n }\n}",
"variables": {
"input": {
"record": "INVOICES"
},
"range": {
"from": "2025-01-15T00:00:00Z",
"to": "2025-01-15T00:00:00Z"
}
}
}
EOF
Variables:
{
"input": {
"record": "INVOICES"
},
"range": {
"from": "2025-01-15T00:00:00Z",
"to": "2025-01-15T00:00:00Z"
}
}
Response:
{
"data": {
"customFieldBreakdown": {
"fieldType": "string",
"groupByKey": "string",
"groupByOwner": "CUSTOMER",
"record": "INVOICES",
"scope": "ALL",
"totalAmount": 0,
"groups": [
{
"amount": 0,
"count": 0,
"label": "string",
"value": "string"
}
]
}
}
}
customFieldBreakdown(
input: CustomFieldBreakdownInput!
range: AnalyticsRangeInput!
): CustomFieldBreakdown!
Arguments
customFieldBreakdown.input ● CustomFieldBreakdownInput! non-null input
Which documents to count, what to group them by, and conditions on their custom fields.
customFieldBreakdown.range ● AnalyticsRangeInput! non-null input
The date range and, optionally, the visibility scope.
Type
CustomFieldBreakdown object
Documents counted and valued by the values of one custom field, in the reader's analytics scope.