SOQL Query: Orders by Owner in Salesforce

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

Orders are only queryable when the Order object is enabled, so an empty result here often means a setup gap rather than missing data.

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.

Orders owned by a named user
SELECT Id, OrderNumber, Status, Owner.Name
FROM Order
WHERE Owner.Name = 'Jane Smith'
ORDER BY CreatedDate DESC

Filter by user ID

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

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

Records owned by inactive users

Orphaned records
SELECT Id, OrderNumber, Status, Owner.Name
FROM Order
WHERE Owner.IsActive = false

Common mistakes to avoid

  • Use the API name Order, 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 orders?
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