SOQL Query: Tasks by Owner in Salesforce

Query tasks 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.

Activity data is stored differently from other objects, so tasks reward tight filters and rarely need every field selected.

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.

Tasks owned by a named user
SELECT Id, Subject, Status, Owner.Name
FROM Task
WHERE Owner.Name = 'Jane Smith'
ORDER BY CreatedDate DESC

Filter by user ID

By 15- or 18-character user ID
SELECT Id, Subject, Status
FROM Task
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 tasks are a standard audit finding.

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

Records owned by inactive users

Orphaned records
SELECT Id, Subject, Status, Owner.Name
FROM Task
WHERE Owner.IsActive = false

Common mistakes to avoid

  • Use the API name Task, 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 tasks?
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