Salesforce is going all-in on Enhanced Domains and they will be mandatory in Winter '23 (October 2022)
However, there is still no way to enable Enhanced Domains when creating a scratch org. Yes, you can manually go in and enable Enhanced Domains in Setup, but that's not a viable approach for CI/CD and automated testing scenarios.
For context: We have found several regressions in functionality when we enable Enhanced Domains in our orgs (mostly around Experience Cloud (f.k.a. Communities f.k.a. Customer Portal)) so it's imperative that we're able to cover our application with Enhanced Domains enabled when running a test suite.
I have tried pulling down the MyDomain Settings metadata and including it in the source push. This is what the metadata looks like when Enhanced Domains are enabled (i.e. after I enable it manually in Setup)
<?xml version="1.0" encoding="UTF-8"?>
<MyDomainSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<canOnlyLoginWithMyDomainUrl>false</canOnlyLoginWithMyDomainUrl>
<doesApiLoginRequireOrgDomain>false</doesApiLoginRequireOrgDomain>
<enableNativeBrowserForAuthOnAndroid>false</enableNativeBrowserForAuthOnAndroid>
<enableNativeBrowserForAuthOnIos>false</enableNativeBrowserForAuthOnIos>
<myDomainName>river-pluto-6376-dev-ed</myDomainName>
<myDomainSuffix>MySalesforce</myDomainSuffix>
<redirectPriorMyDomain>true</redirectPriorMyDomain>
<use3rdPartyCookieBlockingCompatibleHostnames>true</use3rdPartyCookieBlockingCompatibleHostnames>
<useEdge>true</useEdge>
<useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
<useStabilizedSandboxMyDomainHostnames>true</useStabilizedSandboxMyDomainHostnames>
</MyDomainSettings>
This is what it looks like when Enhanced Domains is NOT enabled
<?xml version="1.0" encoding="UTF-8"?>
<MyDomainSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<canOnlyLoginWithMyDomainUrl>false</canOnlyLoginWithMyDomainUrl>
<doesApiLoginRequireOrgDomain>false</doesApiLoginRequireOrgDomain>
<enableNativeBrowserForAuthOnAndroid>false</enableNativeBrowserForAuthOnAndroid>
<enableNativeBrowserForAuthOnIos>false</enableNativeBrowserForAuthOnIos>
<myDomainName>americano-latte-837-dev-ed</myDomainName>
<myDomainSuffix>MySalesforceLimited</myDomainSuffix>
<redirectPriorMyDomain>true</redirectPriorMyDomain>
<use3rdPartyCookieBlockingCompatibleHostnames>true</use3rdPartyCookieBlockingCompatibleHostnames>
<useEdge>false</useEdge>
<useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
<useStabilizedSandboxMyDomainHostnames>false</useStabilizedSandboxMyDomainHostnames>
</MyDomainSettings>
Notice the <useEdge>, <useStabilizedMyDomainHostnames>, and <myDomainSuffix> values are the ones that change when Enhanced Domains is enabled
In summary: Pushing the Settings metadata has no effect. It does not enable Enhanced Domains.
Salesforce is going all-in on Enhanced Domains and they will be mandatory in Winter '23 (October 2022)
However, there is still no way to enable Enhanced Domains when creating a scratch org. Yes, you can manually go in and enable Enhanced Domains in Setup, but that's not a viable approach for CI/CD and automated testing scenarios.
For context: We have found several regressions in functionality when we enable Enhanced Domains in our orgs (mostly around Experience Cloud (f.k.a. Communities f.k.a. Customer Portal)) so it's imperative that we're able to cover our application with Enhanced Domains enabled when running a test suite.
I have tried pulling down the MyDomain Settings metadata and including it in the source push. This is what the metadata looks like when Enhanced Domains are enabled (i.e. after I enable it manually in Setup)
This is what it looks like when Enhanced Domains is NOT enabled
Notice the
<useEdge>,<useStabilizedMyDomainHostnames>, and<myDomainSuffix>values are the ones that change when Enhanced Domains is enabledIn summary: Pushing the Settings metadata has no effect. It does not enable Enhanced Domains.