SOQL delegated scope is reshaping how Salesforce professionals work — and this article breaks down everything you need to know.
I’ve spent a lot of time digging through activity logs, and one thing that always used to bug me was tracking down tasks that just… moved. If you’ve ever had to audit why a task was reassigned, you need to know about the SOQL delegated scope. It’s a specific modifier that lets you find records that were handed off to someone else, and it’s way faster than trying to parse through history tables manually.
How the SOQL delegated scope actually works
The SOQL delegated scope is a bit of a hidden gem within the USING SCOPE clause. Most of us are used to the default behavior of queries, or maybe we’ve used MINE to filter for the current user’s records. But when you use the delegated modifier, you’re asking Salesforce to show you records that were assigned to a different user after an initial assignment occurred.
Think about a sales team where a manager reassigns a bunch of follow-up tasks because a rep is out sick. If you just query for tasks owned by that manager or the new rep, you’re missing the context of the hand-off. This scope bridges that gap. It’s specifically built for Tasks and Events, which are the bread and butter of delegation in most orgs.
Practical uses for the SOQL delegated scope
So why does this matter? Honestly, most teams get their activity reporting wrong because they don’t account for these shifts. I’ve seen teams struggle to figure out why their “Tasks Completed” metrics look wonky, only to realize half the work was delegated and lost in the standard reporting filters. Using the SOQL delegated scope helps you clean that up.
Code Examples
The syntax is pretty straightforward. You just append the clause after the object name. Here’s how you’d grab those records:
SELECT Id, Subject FROM Task USING SCOPE delegatedSELECT Id, StartDateTime FROM Event USING SCOPE delegated
Now, you can also combine this with standard filters. If you only want to see things from the last week, just add your WHERE clause like normal. Just remember that the scope acts as a primary filter before your WHERE logic even kicks in.
Pro Tip: When you use this scope, the query returns data in the context of the previous user. This is a huge detail that trips people up. If you’re running this in Apex, make sure you’ve thought about how Salesforce sharing rules might affect what the running user can actually see.
Things to watch out for
One thing that trips people up is the running user context. Since the SOQL delegated scope looks at records from the perspective of the original owner, the results can change depending on who is clicking the button. I’ve had situations where an admin runs a query and sees 50 records, but a manager runs the same thing and sees five. That’s usually a sharing issue, not a query bug.
Also, if you’re building automation, you really need to decide between Apex vs Flow for handling these results. Apex gives you a bit more control over the “without sharing” context if you absolutely need to see every delegated item for an audit, whereas Flow is going to be strictly bound by the user’s permissions.
Key Takeaways: SOQL delegated scope
- It’s used to find Tasks and Events that were reassigned to someone else.
- You add it using the
USING SCOPE delegatedclause in your SOQL. - It’s perfect for auditing “lost” activities or troubleshooting sales hand-offs.
- The results are context-heavy, so always test with different user profiles.
- You can’t use it on every object – it’s specifically for activities.
Next time you’re asked to build a report on reassigned work or you’re trying to figure out where a task went, don’t just reach for the Activity History. Give the SOQL delegated scope a shot in the Query Editor. It’s a much cleaner way to get the data you need without the headache of building complex join queries or custom tracking fields.








Leave a Reply