2

We have a Visualforce page that provides a sophisticated graphical presentation of data, and part of this is to include links to open various objects' record pages when the link text is clicked. We do this by generating the required URL using, for example:

{!URLFOR($Action.Contact.View, contactId)}

The URL generated this way points to a Classic record page (because the context of generation is a Visualforce page). Normally this is not an issue when the user has Lightning Experience enabled because Salesforce dynamically redirects to the equivalent Lightning record page.

However, when this VF page is used in a Community (with LEX enabled) then this redirection doesn't occur and the user ends up on the Classic record page.

We would like the link to always navigate to the Lightning record page when the user has LEX enabled, whether or not the usage is in a Community.

How can we achieve this without using relative paths? We can't use a relative path because when accessed through a Community, that community's site may have a URL step defined.

1 Answer 1

1

When using URLFOR($Action.ObjectType.View, someId) to generate a URL in a Visualforce page this generates a URL that ends with "/d" in the path. It is this that appears to force the URL to present a "Classic" style of object record page.

Simply removing this part of the URL during processing within the Visualforce code appears to resolve this issue, allowing the Lightning Community usage of the Visualforce page to have links that redirect to Lightning style object record pages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .