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
Snita LalSnita Lal 

New record redirect with visualforce page showing classic on Salesforce1 even with new lightning tab style

Hi,

We are using the below extension class and visualforce page on Account to use in a custom action to create a record. When using the Salesforce1 app the visualforce page shows in a classic view and not in lighning whilst we are using the new lightningStylesheets="true" and we've ticked the checkbox to make the page available in mobile and lightning.

We've ended up down this route as we wanted the user to be redirected to the record created and not the parent on Salesforce1 because the user is expected to do more functionality on the record once created. Ideally we want to achieve this in the simplest way as we feel the process is over engineered.

Any help would be greatly apprieciated.

Thanks,

Snita
 
public with sharing class OppExtension {

Account acc;

public Operational_Opportunities__c opp{get;set;}

public OppExtension(ApexPages.StandardController controller) {
    this.acc= (Account)controller.getRecord();
    opp = new Operational_Opportunities__c();
}

public PageReference save() {
    opp.account__c= acc.Id;
    insert opp;
    
    PageReference pg = new PageReference('/'+Opp.id);
        pg.setRedirect(true);
        return pg;  
}
}

<apex:page standardController="Account" extensions="OppExtension" lightningStylesheets="true" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection > 

  <apex:outputField value="{!Account.Name}"/>
  <apex:inputField value="{!opp.Name}"/>
  <apex:inputField value="{!opp.Type__c}"/>
  <apex:inputField value="{!opp.Stage__c}"/>
  <apex:inputField value="{!opp.Quote_Submission_Date__c}"/>
  <apex:inputField value="{!opp.Close_Date__c}"/>
  <apex:inputField value="{!opp.Service_Start_Date__c}"/>

<apex:commandButton value="Save" Action="{!Save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 
Vinod ChoudharyVinod Choudhary
Hi Sunita,

you have override visual force component instead of standard one. Open view and click on a override VF component.
Steps-> Setup-> Object Manager -> Opportunity Find override vf page in Action and Custom Links There is a checkbox and make sure it's unchecked.

Thanks
Vinod
Snita LalSnita Lal
Hi Vinod,

We haven't done a standard override on opportunity this is a custom object Operational Opportunity where we leverage Force.com to collect transactional orders. Our custom action is on the parent object Account, where we have created a new action, not an override, to use the visualforce page because the standard create record action, took you back to the parent rather than the newly created child record. We have a redirect in the visualforce page and excited to see the lightning style sheet option but this shows in a classic view on Salesforce1 which I didn't think was possible.

This is what it looks like in lightning

User-added image

But then looks like this on Salesforce1

User-added image

Thanks,

Snita