Skip to main content

Use of deprecated Salesforce instance URL

Salesforce regularly moves orgs between server instances for load-balancing and maintenance, which can break any processes that rely on direct, instance-specific URLs.

David Martin avatar
Written by David Martin
Updated yesterday

Overview

Salesforce hosts your orgs in various ‘instances’ (e.g. na1.salesforce.com). However, they frequently move orgs between these instances to balance server load or to perform server maintenance. Direct links to specific Salesforce instances will stop working during this time, which could impact business processes which depend on linking out to specific Salesforce data.

Example

The following apex code is incorrect:

String leadUrl = '<https://us1.salesforce.com/>' + myLead.Id;

Instead you should use the URL.getOrgDomainUrl() method.

This is correct:

String leadUrl = URL.getOrgDomainUrl().toExternalForm() + '/' + myLead.Id;
Did this answer your question?