Newer Version Available
MyDomainSettings
File Suffix and Directory Location
MyDomainSettings values are stored in a single file named MyDomain.settings in the settings directory. The .settings files are different from other named components because there’s only one settings file for each settings component.
Version
MyDomainSettings components are available in API version 47.0 and later.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| canOnlyLoginWithMyDomainUrl | boolean | If true, users must use the org's My Domain login URL to log in. If false (default), users can also log in using the org’s instance Salesforce URL, https://InstanceName.salesforce.com, and through the login URL https://login.salesforce.com. |
| doesApiLoginRequireOrgDomain | boolean | If true, users must use the org’s My Domain login URL to access the Salesforce API. If false (default), users can also access the Salesforce API using the generic Salesforce page, https://InstanceName.salesforce.com and through the login URL https://login.salesforce.com. |
| domainPartition | OrgDomainShard (enumeration of type string) | The partition for this org. When none,
partitioned domains aren’t enabled. Otherwise, My Domain hostnames include the
partition value. For example, the format of a My Domain login hostname for a
Developer Edition org with partitioned domains is
MyDomainName.develop.my.salesforce.com. This
field is read-only in the API. Possible values are:
Sandbox orgs are partitioned when you enable enhanced domains. This feature is available before Winter ’23 in some non-production and non-sandbox orgs with enhanced domains. When each partition is available, new orgs of that type are partitioned by default. For updates about the availability of this feature, join the My Domain and Enhanced Domains group in the Trailblazer Community. When each partition is available, new orgs of that type with enhanced domains are partitioned by default and get the corresponding domainPartition value. Production orgs and orgs without enhanced domains always have a value of none. Available in API version 55.0 and later. |
| enableNativeBrowserForAuthOnAndroid | boolean | If true, use the native browser for authentication of Android mobile apps. Default is false. |
| enableNativeBrowserForAuthOnIos | boolean | If true, use the native browser for authentication of iOS mobile apps. Default is false. |
| myDomainName | string | The subdomain name used in My Domain URLs for this org, such as MyDomainName.my.salesforce.com
and MyDomainName.lightning.force.com. This field is read-only in the API. You can change your org’s My Domain name from the My Domain Setup page. Available in API version 51.0 and later. |
| myDomainSuffix | OrgDomainProdSuffix (enumeration of type string) | The domain suffix for this org’s My Domain login URL. This field is read-only
in the API. You can change your My Domain suffix from the My Domain Setup
page. Possible values are:
Available in API version 51.0 and later. |
| redirectForceComSitesUrls | boolean | If true, calls to URLs ending in
.force.com that serve your Experience Cloud sites and
Salesforce Sites are redirected to the corresponding current My Domain site URL. If
false, these calls aren’t redirected and the
user gets a file not found (404) error. The default is true. This field is only applicable when
Available in API version 55.0 and later. |
| redirectPriorMyDomain | boolean | If true, calls to URLs associated with
your previous My Domain name are redirected to the corresponding URL associated with
your current My Domain. If false, these calls
aren’t redirected. When you deploy a new My Domain, this setting resets to its
default, true. This field is only applicable when
Available in API version 54.0 and later. |
| use3rdPartyCookieBlockingCompatibleHostnames | boolean | Indicates whether the org’s instance name is included in Visualforce URLs when
third-party cookies are blocked (true) or not
(false). This field has a default value of
true. Setting this field true prevents potential issues loading Visualforce
pages with stabilized URLs. Only applicable when useStabilizedMyDomainHostnames is set to true and myDomainSuffix is set to MySalesforceLimited, CloudforceLimited, or DatabaseLimited. Available in API version 51.0 and later. |
| useEdge | boolean | Indicates whether this org’s qualifying My Domain URLs are routed through
Salesforce Edge Network (true) or not (false). This field has a default value of true. This field is read-only in the API. If your org can use Salesforce Edge Network, you can enable this setting from the My Domain Setup page. After this field is set to true from Setup, it can't be set to false. Available in API version 51.0 and later. |
| useEnhancedDomainsInSandbox | boolean | If enhanced domains aren’t enabled, indicates whether new and refreshed
sandboxes created from this org use enhanced domains by default (true) or not (false). The default value is true. If enhanced domains are enabled, new and refreshed sandboxes created from this org always use enhanced domains and this field has no effect. Available in API 55.0 and later. |
| useStabilizedMyDomainHostnames | boolean | Indicates whether the instance name is hidden in My Domain URLs for Visualforce, Experience Builder, Site.com Studio, and content files (true) or not (false). This field has a default value of true. For example, MyDomainName--PackageName.na44.visual.force.com becomes MyDomainName--PackageName.visualforce.com when this field is set to true. |
| useStabilizedSandboxMyDomainHostnames | boolean | This field corresponds to the Stabilize the Hostname for My Domain URLs in
Sandboxes release update, which was enforced in Summer ’20. When true, the instance name is hidden in My Domain URLs for sandboxes orgs. For example, MyDomainName--test.cs5.my.salesforce.com became MyDomainName--test.my.salesforce.com. As of API version 49.0, this field's value is always true, regardless of the value that you set. Changing its value has no effect on Salesforce, even if it reads false. This change applies retroactively back to API version 47.0, when this field was first introduced. Previously, in API version 47.0 to 49.0, this field indicated whether the instance name was hidden in My Domain URLs for sandboxes orgs (true) or not (false), and the field's default value was false. Now, in all API versions, this field's value is always true, even if it reads false. |
Declarative Metadata Sample Definition
The following is an example of a MyDomainSettings component.
1<?xml version="1.0" encoding="UTF-8"?>
2<MyDomainSettings xmlns="http://soap.sforce.com/2006/04/metadata">
3 <canOnlyLoginWithMyDomainUrl>false</canOnlyLoginWithMyDomainUrl>
4 <doesApiLoginRequireOrgDomain>false</doesApiLoginRequireOrgDomain>
5 <domainPartition>none</domainPartition>
6 <enableNativeBrowserForAuthOnAndroid>false</enableNativeBrowserForAuthOnAndroid>
7 <enableNativeBrowserForAuthOnIos>false</enableNativeBrowserForAuthOnIos>
8 <myDomainName>mycompany</myDomainName>
9 <myDomainSuffix>MySalesforce</myDomainSuffix>
10 <use3rdPartyCookieBlockingCompatibleHostnames>true</use3rdPartyCookieBlockingCompatibleHostnames>
11 <useEdge>true</useEdge>
12 <useEnhancedDomainsInSandbox>true</useEnhancedDomainsInSandbox>
13 <useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
14 <useStabilizedSandboxMyDomainHostnames>true</useStabilizedSandboxMyDomainHostnames>
15</MyDomainSettings>The following is an example package.xml that references the previous definition.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>MyDomain</members>
5 <name>Settings</name>
6 </types>
7 <version>54.0</version>
8</Package>