---
schema_version: "1"
id: bc563a97c62739597148f1e06be6704c91deff5a88020445b3e488f4d5669277
title: Link to Salesforce Domains in Packages
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/domain_name_package_guidance.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.domain_name_package_guidance.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 9afc032fefee6938801bcf00a11b692fcbee591b82374580d5d2e12d5e8d79c4
description: 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.
products:
  - Salesforce Platform
  - Cross Cloud
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Group</strong>, <strong>Essentials</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and<strong> Developer</strong> Editions</td></tr></tbody></table>

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](https://help.salesforce.com/s/articleView?id=xcloud.domain_name_url_format_changes_enable_enhanced.htm&release=264.0.0&type=5 "Understand how login and application URL formats changed when enhanced domains, the latest version of My Domain, were deployed. These changes apply only to orgs created in June 2022 or earlier.").

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](https://developer.salesforce.com/docs/atlas.en-us.pkg1_dev.meta/pkg1_dev/packaging_instanceless_url.htm) 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](https://developer.salesforce.com/docs/atlas.en-us.pkg1_dev.meta/pkg1_dev/packaging_instanceless_url.htm) 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.

#### See Also

- [My Domain](https://help.salesforce.com/s/articleView?id=xcloud.domain_name_overview.htm&release=264.0.0&type=5 "Showcase your company’s brand with a customer-specific subdomain name in your Salesforce org URLs. With My Domain, you can include your company name in your URLs, for example, https://mycompany.my.salesforce.com. With these org-specific URLs, you can set up a custom login page, set a custom login policy, offer single sign-on, and allow users to log in with a social account. My Domain also allows you to work in multiple Salesforce orgs in the same browser at the same time.")
- [Enhanced Domains](https://help.salesforce.com/s/articleView?id=xcloud.domain_name_enhanced.htm&release=264.0.0&type=5 "Enhanced domains are the current version of My Domain that meets the latest browser requirements. With enhanced domains, all URLs across your org contain your company-specific My Domain name, including URLs for your Experience Cloud sites, Salesforce Sites, Visualforce pages, and content files. This feature changed domain suffixes (the part after the My Domain name) to meet the latest security standards. With no instance names, enhanced My Domain URLs are easier for users to remember and don’t change when your org is moved to another Salesforce instance. Because enhanced domains meet the latest browser requirements, this feature was enforced in Winter ’24.")
- [Partitioned Domains](https://help.salesforce.com/s/articleView?id=xcloud.domain_name_partitioned_domains.htm&release=264.0.0&type=5 "With partitioned domains, My Domain host names for your Developer Edition org, demo org, patch org, sandbox, scratch org, or Trailhead Playground include a word related to the org type. For example, partitioned domains for Developer Edition and patch orgs include the word develop. Partitioned domains allow Salesforce to maximize the availability of your orgs by gradually rolling out delivery changes. And it’s easier to identify an org by a URL when the domain is partitioned.")