Newer Version Available

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

MyDomainSettings

Represents your org’s My Domain settings. With My Domain, you can include your company name in your URLs, for example, https://yourcompanyname.my.salesforce.com. This type extends the Metadata metadata type and inherits its fullName field.

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:
  • demo—Used in demo orgs with partitioned domains
  • develop—Used in Developer Edition orgs with partitioned domains
  • free—Used in free orgs with partitioned domains
  • none—Indicates that this org doesn’t use partitioned domains
  • patch—Reserved for internal use
  • sandbox—Used in sandboxes with partitioned domains
  • scratch—Used in scratch orgs with partitioned domains
  • sfdctest—Reserved for internal use
  • trailblaze—Used in Trailblazer Playgrounds with partitioned domains

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:
  • CloudforceLimitedcloudforce.com
  • DatabaseLimiteddatabase.com
  • MySalesforcemy.salesforce.com with enhanced domains
  • MySalesforceLimitedmy.salesforce.com without enhanced domains
  • OrgLevelCertificateLimitedmy-salesforce.com
  • Restricted1—Reserved for future use.

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
  • Enhanced domains are enabled.
  • Your org has a previous *.force.com URL associated with an Experience Cloud site or Salesforce Site.

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
  • Your org has a previous My Domain. For example, after an admin renames the My Domain or changes the My Domain suffix.
  • The previous My Domain hasn’t been removed via the Routing options on the My Domain Setup page. If the previous My Domain is removed, calls to URLs associated with that My Domain aren’t redirected.

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.

If enhanced domains are enabled in your org, your URLs are different and this setting has no effect. For details, see My Domain URL Formats in Salesforce Help.

Note

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.

If enhanced domains are enabled in your org, your URLs are different and this setting has no effect. For details, see My Domain URL Formats in Salesforce Help.

Note

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>