Query case history and field change events for Salesforce Service Cloud cases via SOQL

domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.

Steps

  1. Authenticate to the Salesforce REST or SOAP API with an OAuth access token; ensure the connected app or user has Read access to the CaseHistory object.
  2. Query the CaseHistory object to retrieve field changes for a specific case: SELECT Field, OldValue, NewValue, CreatedDate, CreatedById FROM CaseHistory WHERE CaseId = 'your_case_id' ORDER BY CreatedDate ASC.
  3. To retrieve history across many cases efficiently, add a CreatedDate range filter: WHERE CreatedDate >= LAST_N_DAYS:30 and paginate using the nextRecordsUrl in the REST API response.
  4. For fields tracked beyond the standard 18-month CaseHistory retention window, query the FieldHistoryArchive object (requires Field Audit Trail add-on): SELECT ParentId, Field, OldValue, NewValue, CreatedDate FROM FieldHistoryArchive WHERE ParentObjectType = 'Case' AND CreatedDate >= {date_literal}.
  5. Map the Field column values (which are internal API names) to user-friendly labels using the case object's field metadata endpoint or a static lookup table.
  6. For compliance exports, combine CaseHistory with SetupAuditTrail (for admin-level configuration changes) and CaseComment, CaseFeed for a complete case activity picture.

Known gotchas

Related routes

Create Salesforce Service Cloud cases via the REST API
developer.salesforce.com · 6 steps · unrated
Create a Salesforce Service Cloud case and trigger Einstein Case Classification to auto-populate category fields
developer.salesforce.com · 6 steps · unrated
Query Salesforce Big Objects with SOQL-style async queries and understand the indexing constraints
developer.salesforce.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans