0

I'm trying to override View action of a Standard Object (Opportunity in this case) with a Visualforce page. My override works on both Classic and Lightning theme. However, on lightning pages, my Visualforce page changes the original page's layout.

My Visualforce Page:

<apex:page standardController="Opportunity" lightningStylesheets="true">
    <apex:detail subject="{!Opportunity.Id}" relatedList="true" title="true" rendered="true" />
</apex:page>

It works perfectly on the Classic theme, but here is how it looks on Lightning compared to the original page without override:

enter image description here

How do I achieve the functionality of creating a generic Visualforce page to load both classic pages and lightning pages? And if it's not possible, what are the alternatives to achieve it?

  • Why do you need VF page? Can you give more info about your requirement? it looks like xyproblem.info – Pranay Jaiswal Jul 13 '18 at 8:32
0

The main reason to introduce lightningStylesheets=true is to style the VF page components with SLDS. For example if you use apex components like apex:inputField, apex:detail, etc. It will try make it look like as if you have created the page using lightning component.

The main thing to understand here is it won't add additional components.

Like in apex:detail component we do not have path component available. It will just style all the components with SLDS on the visualforce page. No additional component gets added.

  • So I do I get around this to achieve the functionality of creating a generic vfp to load both classic pages and lightning pages? – Lewis Bushman Jul 13 '18 at 8:11
  • I suppose you will have to create a custom lightning component to handle this. This link will help you more in differentiating the override for classic and lightning. – Hemant Jain Jul 13 '18 at 8:40
0

apex:detail was designed for the classic view originally and it doesn't have components from LEX. You will have to design a vf page which adds path component when it is accessed in the LEX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.