function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aviv GabayAviv Gabay 

I'm trying to replace the view of a standard page with my custom VF page. This works great on the classic theme but not on the lightning theme and mobile application.

I'm trying to replace the view of a standard page with my custom VF page.
This works great on the classic theme but not on the lightning theme and mobile application.

 - In the VFP I checked "Available for Lightning Experience, Lightning
   Communities, and the mobile app".

[![enter image description here][1]][1]

 - In the view override, I checked "Use the Salesforce Classic
   override".

[![enter image description here][2]][2]

Visualforce page (I don't think it has something to do with the page itself, it doesn't work with any page):

    <apex:page standardController="Opportunity" lightningStylesheets="true">
        <apex:detail subject="{!Opportunity.Id}" relatedList="true" title="true" rendered="{!Opportunity.Amount < 10}" />
        <apex:pageBlock rendered="{!Opportunity.Amount > 10}">
            <apex:pageBlockSection columns="1">
                <apex:pageMessage summary="Amount is less than 10" severity="warning" strength="3" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:page>

I think that the problem is that for some reason the override doesn't even get fired on lightning experience. In the classic, I can see the URL changing to an APEX page, but on the lightning, it doesn't even bother trying to change the URL

 - **URL in classic view (successful redirection):**

`https://c.eu16.visual.force.com/apex/xxx`

 - **URL in lightning (doesn't redirect):**

`https://eu16.lightning.force.com/lightning/r/Opportunity/0061t000001uPaDAAU/view`



**EDIT:**

Although I really don't like this option, I tried creating a lightning component using the following code:

    <aura:component implements="flexipage:availableForAllPageTypes" access="global" >
        <aura:attribute name="greeting" type="String" default="Hello" access="global" />
        <aura:attribute name="subject" type="String" default="World" access="global" />
    
        <div style="box">
          <span class="greeting">{!v.greeting}</span>, {!v.subject}!
        </div>
    </aura:component>

and changed the view override to the created component. I couldn't get it working that way too.


  [1]: https://i.stack.imgur.com/jwBpF.png
  [2]: https://i.stack.imgur.com/MhjzR.png
pankul guptapankul gupta
Change your VF Page code a little and it should work if it is working in Classic, I tried the same in my Org and it worked fine as expected:
<apex:page standardController="Opportunity" lightningStylesheets="true">
        <apex:detail subject="{!Opportunity.Id}" relatedList="true" title="true" rendered="{!IF(AND(NOT(ISBLANK(Opportunity.Amount)),Opportunity.Amount<10),'Yes','No')}" />
        <apex:pageBlock rendered="{!IF(AND(NOT(ISBLANK(Opportunity.Amount)),Opportunity.Amount>10),'Yes','No')}">
            <apex:pageBlockSection columns="1">
                <apex:pageMessage summary="Amount is less than 10" severity="warning" strength="3" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:page>
Let me know if it helps.
 
Aviv GabayAviv Gabay
It still doesn't redirect, just load the original page in Lightning.