Newer Version Available
MyDomainSettings
Represents your org’s My Domain settings. My Domain
is a Salesforce Identity feature that lets you create your own subdomain to better manage
login and authentication. With a My Domain subdomain, you replace the instance name that
Salesforce assigned you, such as https://na130/salesforce.com with a name
that you choose, such as
https://YourCompanyName.my.salesforce.com. With My
Domain, you can create a custom login page and custom login policies to control how users are
authenticated. You can also set up single sign-on (SSO) and social sign-on, work in multiple
orgs at the same time, and more.
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 is 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 their My Domain URL to log in. If false (default), users can also log in using their instance Salesforce URL, https://InstanceName.salesforce.com, and through the login URL https://login.salesforce.com. |
| doesApiLoginRequireOrgDomain | boolean | If true, users must use their My Domain URL to access the Salesforce API. If false (default), users can also access the Salesforce API using their generic Salesforce page, https://InstanceName.salesforce.com and through the login URL https://login.salesforce.com. |
| 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. |
| 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 | Indicates whether the instance name is hidden in My Domain URLs for sandboxes orgs (true) or not (false). This field has a default value of true. For example, MyDomainName--test.cs5.my.salesforce.com becomes MyDomainName--test.my.salesforce.com when this field is set to true. |
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 <enableNativeBrowserForAuthOnAndroid>false</enableNativeBrowserForAuthOnAndroid>
6 <enableNativeBrowserForAuthOnIos>false</enableNativeBrowserForAuthOnIos>
7 <useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
8 <useStabilizedSandboxMyDomainHostnames>true</useStabilizedSandboxMyDomainHostnames>
9</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>47.0</version>
8</Package>