Newer Version Available

This content describes an older version of this product. View Latest

USING SCOPE

The optional USING SCOPE clause of a SOQL query returns records within a specified scope. For example, you can limit the records to return only objects that the user owns or only records in the user’s territory.

With API version 32.0 and later, you can use USING SCOPE to limit the results of a query to a specified filterScope. The syntax is:

1[USING SCOPE filterScope]
filterScope can take one of the following enumeration values:
Delegated
Filter for records delegated to another user for action. For example, a query could filter for only delegated Task records.
Everything
Filter for all records.
Mine
Filter for records owned by the user running the query.
My_Territory
Filter for records in the territory of the user running the query. This option is available if territory management is enabled for your organization.
My_Team_Territory
Filter for records in the territory of the team of the user running the query. This option is available if territory management is enabled for your organization.
Team
Filter for records assigned to a team, such as an Account team.

filterScope in SOQL is different from filterScope used in Metadata API.

Note