Newer Version Available

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

Territory2Settings

Represents an org’s Territory2 settings. Use Territory2 settings to set the access level that Territory Management 2.0 users have to records associated with sales territories, and to enable features. The standard record access settings apply to accounts and opportunities. If your Salesforce org uses Private default internal access for contacts or cases, you can also set access for those records. This type extends the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

In the package manifest, all organization settings metadata types are accessed using the “Settings” name. See Settings for more details.

Territory2Settings values are stored in a single file named Territory2.settings in the settings directory of the corresponding package directory. The .settings files are different from other named components because there is only one settings file for each settings component.

Version

Territory2Settings is available in API version 32.0 and later.

Special Access Rules

The Territory2Model object has a State field in the SOAP API. States include Planning, Active, Archived, and a number of other states, such as Cloning, that indicate that a process is underway. Users who do not have the “Manage Territories” permission can access only territories that belong to the model in Active state. The “Manage Territories” permission is required for deploy() calls for all territory management entities, in addition to the “Modify All Data” permission required by Metadata API. Using retrieve() without the “Manage Territories” permission will return only entities that belong to a Territory2Model in Active state. We recommend against retrieving without the “Manage Territories” permission because the call will retrieve only partial data.

Fields

Field Name Field Type Description
defaultAccountAccessLevel string Sets the default level of access that users have to account records in territories: view and edit accounts assigned to territories or view, edit, transfer, and delete accounts assigned to territories.
defaultCaseAccessLevel string Sets the default level of access that users have to case records in territories: view and edit accounts assigned to territories or view, edit, transfer, and delete accounts assigned to territories.
defaultContactAccessLevel string Sets the default level of access that users have to contact records in territories: view and edit accounts assigned to territories or view, edit, transfer, and delete accounts assigned to territories.
defaultOpportunityAccessLevel string Sets the default level of access that users have to opportunity records in territories: view and edit accounts assigned to territories or view, edit, transfer, and delete accounts assigned to territories.
enableTerritoryManagement2 boolean Enables and disables Enterprise Territory Management only. If true, Enterprise Territory Management is enabled. If false (default), Enterprise Territory Management is not enabled. Enabling and disabling Enterprise Territory Management is exclusive of all other operations, and the field value must be true before other territory-management operations can run.

Available in API version 47.0 and later.

Declarative Metadata Sample Definition

The following example shows the definition of a Territory2Settings component.

1<?xml version="1.0" encoding="UTF-8"?>
2<Territory2Settings xmlns="http://soap.sforce.com/2006/04/metadata">
3    <defaultAccountAccessLevel>Owner</defaultAccountAccessLevel>
4    <defaultOpportunityAccessLevel>Read</defaultOpportunityAccessLevel>
5    <defaultCaseAccessLevel>None</defaultCaseAccessLevel>
6    <defaultContactAccessLevel>Edit</defaultContactAccessLevel>
7    <enableTerritoryManagement2>true</enableTerritoryManagement2>
8</Territory2Settings>

Usage

Territory Management 2.0 components don’t support packaging or change sets and aren’t supported in CRUD calls.

Wildcard Support in the Manifest File

The wildcard character * (asterisk) in the package.xml manifest file doesn’t apply to metadata types for feature settings. The wildcard applies only when retrieving all settings, not for an individual setting. For details, see Settings. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.