SOQL Query: Cases by Owner in Salesforce

Query cases by owner in SOQL - filter on OwnerId, dot-walk to Owner.Name, and count records per owner before a reassignment.

Updated 2026-09-09

Ownership queries answer the two questions that precede every territory change: who owns what, and how much will move.

Support orgs generate cases faster than any other object, which makes LIMIT and selective filters mandatory rather than optional.

Filter by owner name

Owner.Name dot-walks to the related User record. It reads well, but filtering on OwnerId is faster and immune to name changes.

Cases owned by a named user
SELECT Id, CaseNumber, Subject, Owner.Name
FROM Case
WHERE Owner.Name = 'Jane Smith'
ORDER BY CreatedDate DESC

Filter by user ID

By 15- or 18-character user ID
SELECT Id, CaseNumber, Subject
FROM Case
WHERE OwnerId = '005XXXXXXXXXXXXXXX'

Count per owner before a reassignment

Run this before a mass owner change so you know the blast radius. Pair it with a query for inactive owners - orphaned cases are a standard audit finding.

Workload distribution
SELECT OwnerId, COUNT(Id) total
FROM Case
GROUP BY OwnerId
ORDER BY COUNT(Id) DESC

Records owned by inactive users

Orphaned records
SELECT Id, CaseNumber, Subject, Owner.Name
FROM Case
WHERE Owner.IsActive = false

Common mistakes to avoid

  • Use the API name Case, not the UI label - the two differ on several standard objects.
  • Wrap literal text values in single quotes; date literals such as LAST_N_DAYS:30 must stay unquoted.
  • Run the query in a sandbox first if it feeds a bulk update - a WHERE clause that is one character off can select the whole table.

Run it faster with TurboKit

Reassignment work means exporting the matching IDs and importing them back with a new OwnerId.

TurboKit's AI SOQL builder lets you describe the result you want in plain English, returns the query, and exports the rows to CSV or Excel in the same panel - without leaving the Salesforce tab you are already on.

Frequently asked questions

Should I filter on OwnerId or Owner.Name?
OwnerId for anything scheduled or automated - it is indexed and stable. Owner.Name is fine for ad-hoc investigation, but it breaks when someone changes their name.
Can queues own cases?
For objects that support queues, OwnerId can hold a Group ID instead of a User ID. Filtering on Owner.Type distinguishes the two.
Why do I see fewer records than my colleague?
SOQL run through the UI or API respects sharing rules for that user. Admins with View All Data see the full set; everyone else sees their share.

More from the SOQL Library

Related reading