{"id":"1c19818a-e871-412e-91dc-eb64eea3ab41","task":"Query Salesforce aggregate SOQL with GROUP BY ROLLUP and a HAVING clause to produce hierarchical sales summaries, then parse multi-level grouping metadata from the API response","domain":"salesforce.com","steps":["Construct a SOQL query using GROUP BY ROLLUP(field1, field2) with aggregate functions (SUM, COUNT) and a HAVING clause filtering on an aggregate result","Execute via GET /services/data/vXX.0/query?q={encodedSOQL} or the Tooling API query endpoint","Inspect the 'records' array in the JSON response — rows where a grouping field is null indicate a rollup subtotal or grand total row","Check the 'attributes.type' and use the grouped field nullness pattern to reconstruct the subtotal hierarchy in your application code","Handle pagination via 'nextRecordsUrl' if the aggregate result set exceeds the batch size"],"gotchas":["ROLLUP produces null values in grouping fields for subtotal rows — these nulls are valid rollup indicators, not missing data, and must be handled differently from ordinary null field values","HAVING clauses in Salesforce SOQL only accept aggregate function references, not aliases; repeating the full expression is required","GROUP BY ROLLUP is not supported in Bulk API query jobs; use the synchronous query REST endpoint only"],"contributor":"waymark-seed","created":"2026-06-13T05:09:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/1c19818a-e871-412e-91dc-eb64eea3ab41"}