Loading
Prepare for Email to Become the Default Login ExperienceRead More
Set Up and Maintain Your Salesforce Organization
Link to Salesforce Domains in Packages

Link to Salesforce Domains in Packages

If you provide a package to Salesforce customers through AppExchange, review your code for hard-coded URLs and code that parses a known URL. The URLs that Salesforce serves for a target org vary based on the org type and configuration. Hard-coded URLs and code that assumes the format of a URL can break when a customer deploys enhanced domains, deploys partitioned domains, or changes their My Domain name. Also, URL formats vary between production orgs, sandboxes, and other non-production orgs. To ensure that your package functionality continues to work with all possible URL formats, update hard-coded URL references to relative URLs whenever possible. When a relative URL isn’t possible, use a dynamically generated host name.

Required Editions

Available in: both Salesforce Classic and Lightning Experience
Available in: Group, Essentials, Professional, Enterprise, Performance, Unlimited, and Developer Editions

To build packages that support all possible URL formats, check your package for hard-coded URLs. For example, a link to embedded content on a Visualforce page or a button that calls a Visualforce page. If the link includes a URL in plain text, the corresponding functionality can break when enhanced domains or partitioned domains are deployed. To find hard-coded URLs in your package, search your code for the domain suffixes on My Domain URL Format Changes with Enhanced Domains Deployment.

If you find a hard-coded URL, we recommend that you replace it with a relative URL whenever possible. For example, to create a link from one Visualforce page to another, use the path without the *.com host name. If your package functionality requires a full host name, use the Apex System.DomainCreator class to get the corresponding host names. With this method, your package to works in all orgs, regardless of the org type, My Domain settings, and whether partitioned domains are enabled. For more information, see Call Salesforce URLs Within a Package in the First-Generation Managed Packaging Developer Guide.

If you find code in your package that parses a known URL or domain to get a value, we recommend that you update that code to use the System.DomainParser and System.Domain Apex classes. For more information, see Call Salesforce URLs Within a Package in the First-Generation Managed Packaging Developer Guide.

Deliver and Communicate Updates

If your package requires updates, we recommend that you offer those fixes in a minor or patch release if possible. Customers are more likely to adopt a minor or patch release, rather than a major release. Also, because customers often remain on the major release that they initially installed, consider offering a minor or patch release for each major release in the field.

To help your customers plan, clearly communicate which versions of your package support enhanced domains and partitioned domains. Also specify any prior major versions for which you can’t offer support for those features.

 
Loading
Salesforce Help | Article