Loading

Embedded Visualforce page not displayed in record page layout in Classic UI

Fecha de publicación: Aug 20, 2024
Descripción

In Salesforce Classic, Visualforce pages embedded in an object's record page layout sometimes aren’t rendered if the user’s browser blocks third-party cookies or if your org enables the Require first-party use of Salesforce cookies setting on the My Domain Setup page. 

This issue occurs because loading an authenticated Visualforce page within an iframe requires a Salesforce session cookie. In Classic, the parent record page can use a different domain than the embedded Visualforce page, so the session cookie is treated as a third-party cookie and is blocked.

Note: All unmanaged Visualforce pages are now served on the force.com domain when not accessing a site domain. To find out if this change affects you, see Ensure Access to Your Visualforce Pages in Summer ’24 and Winter ’25.

Several major browsers have already disabled third-party cookies by default, including Mozilla Firefox, Apple Safari, and Brave. In January 2024, Google started a gradual rollout of its Privacy Sandbox initiative, which phases out support for third-party cookies in its Chrome browser and enforces storage partitioning in third-party contexts. However, in July 2024, Google reversed its plans to completely block third-party cookies. Instead, Chrome users can decide whether to block third-party cookies.

Despite Google’s recent reversal, Salesforce moves ahead with its plans to end reliance on third-party cookies, such as moving Setup pages to the new *.salesforce-setup.com domain. Other popular browsers already block third-party cookies by default, and Salesforce expects that many users will choose to block third-party cookies due to privacy concerns.

Solución

Switch to Lightning Experience

To ensure that embedded Visualforce pages appear correctly in page layouts, we highly recommend that your org transitions to Lightning Experience and that all users work in the Lightning Experience interface. See How to Transition to Lightning Experience in Salesforce Help.

 

Override the Record Page with a Visualforce Page

Alternatively, if your users still work in Classic, you can override an object’s standard record page with the Visualforce page. Within the Visualforce page, include either:

Note: Lightning Out is a pilot or beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Directory. Use of this pilot or beta service is at the Customer's sole discretion.

To override the standard record page with your Visualforce page:

  1. From the Object Manager settings in Setup, select the object that you want to override.

  2. Click Buttons, Links, and Actions.

  3. From the list, click either: 

    • View–the detail page of a record

    • Edit–the edit page of a record. 

    To override the desired page, click Edit from the dropdown menu. 

  1. In the Salesforce Classic Override section, select Visualforce page as the override type, and then select your Visualforce page’s name from the dropdown menu.

  2. To apply the same Visualforce page in Lightning Experience or the Salesforce mobile app, select Use the Salesforce Classic override.

  3. Save your changes.

For an example, see Override an Existing Page with a Visualforce Page in the Visualforce Developer Guide.

 

Reenable Third-Party Cookies

As another workaround, you can pursue options that allow users’ browsers to reenable third-party cookies. For example, if your company uses Google Chrome Enterprise through a managed instance, your Chrome administrator can set policies that allow or restrict third-party cookies. See Chrome Enterprise third-party cookie policies on Google’s Privacy Sandbox website.

Note: To use this workaround, you may need to disable the Require first-party use of Salesforce cookies setting in your org unless you allow [*.]force.com with the CookiesAllowedForUrls Google Chrome policy. For more information about this setting, see Test the Impact of Blocked Salesforce Session Cookies in Salesforce Help.

Número del artículo de conocimiento

000385969

 
Cargando
Salesforce Help | Article