Loading
Prepare for Email to Become the Default Login ExperienceRead More
Intermittent freezing when using using certain browser versionsRead More
Set Up and Maintain Your Salesforce Organization
Replace Static URLs

Replace Static URLs

Lightning Experience doesn't support the use of static URLs to link to Salesforce resources. Fortunately, there's a much better alternative that future proofs your URLs. URLFOR is a function that calculates a URL based on inputs, rather than relying on something static that can't change. Use the URLFOR function with the appropriate action instead of direct URLs.

Required Editions

Available in: Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions
User Permissions Needed
To create, edit, or delete Visualforce pages: Customize Application

Because static URLs can be applied in many ways, it’s not possible to cover all possibilities. Let’s look at a case where a static URL is used to link to the edit page for an account. Then you can use this example, including the code samples, as a guide for addressing other static URLs in your pages.

  1. Locate href and .Id} in the Visualforce code.
    1. From Setup, enter Visualforce in the Quick Find box, then select Visualforce Pages.
    2. Click Edit next to the Visualforce page.
    3. Search the Visualforce markup for each of the following: href and .Id}.
      <apex:page standardController="Account" lightningStylesheets="true">    
        <apex:outputLink value="/{!Account.Id}/e" >Edit Account</apex:outputLink> 
      </apex:page>
  2. Determine where the static URL is redirecting to. You can figure this out by testing the Visualforce page in Salesforce Classic.
  3. Find the appropriate URLFOR action to replace window.location.
  4. Replace all static URLs with URLFOR functions.
    <apex:page standardController="Account" lightningStylesheets="true">   
      <apex:outputLink value="{!URLFOR($Action.Account.Edit, Account.Id, null, true)}">Edit Account</apex:outputLink>   
    </apex:page>
  5. Save your changes.
 
Loading
Salesforce Help | Article