2

I am distributing a managed package which includes a lightning app built with LWC. In my dev org I needed to enable My Domain to get it to work.

I've tested installing my package on an org without My Domain enabled and the lightning app does not load or show any type of error message, I suspect because My Domain is not enabled and the domain is a standard instance url (naxxx.salesforce.com).

Edit: confirmed by enabled my domain in target org and the lightning app works.

  1. Is there a way to only allow orgs with my domain enabled to install the package?

  2. if not, what is the best course of action to deal with orgs that do not have my domain enabled?

1 Answer 1

1

Is there a way to only allow orgs with my domain enabled to install the package?

I don't believe it's possible to establish an explicit dependency on My Domain. It's not available in packaging as a selectable feature dependency, and I don't think there's any way to include a component reference that would implicate My Domain (other than using features like LWC that require but don't enforce it!)

if not, what is the best course of action to deal with orgs that do not have my domain enabled?

What we (Salesforce.org, where I work) do is deliver our applications via an off-AppExchange installer that allows us to run preinstall checks on subscriber orgs, including a check for My Domain that we use on many products. The open source project that runs this is called MetaDeploy.

That's a big move to make, though. Within the scope of your application, I think your best bet is to deliver a message to the user, possibly through an email sent from a postinstall script, to let them know upon install that the package isn't going to work. You can get the org's domain name in Apex and check if it contains the string .my., for example.

1
  • 2
    Side note - sounds like My Domain is going to be required by Winter 22, so hopefully that will encourage folks to get moving on enabling it now it is appearing in the critical update/release note section Commented Sep 25, 2020 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .