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
D srinivas 8734D srinivas 8734 

i have data in custom setting so i am displaying custom setting data on visualforce page with edit button ?

i have data in custom setting so i am displaying custom setting data on visualforce page with edit button if we click edit button then we can change data & save the record ,after saving the record it has to redirect to edit page .
here i am facing issue with redirect to edit page 
my code is 
public class configpage {
    public   string  clientid {get;set;}
    public   string  clientSecret {get;set;}   
    public   string scope{get;set;}
    public   string  realmid {get;set;}
    public   string  redirecturi {get;set;}
    public  final Quickbook__c acct;
    
    public   boolean firstPanel{get;set;}
    public   boolean secondPanel{get;set;}
    public   boolean thirdPanel{get;set;}
    //public PageReference refresh=ApexPages.currentPage();

    public configpage(){
     //this.acct=(Quickbook__c)controller.getRecord();        
        firstPanel = true;
        secondPanel = true;
        thirdPanel = false;
     Quickbook__c qbcss= Quickbook__c.getorgdefaults();
        //[select ClientId__c,Clientsecret__c,Scope__c,realmid__c,Redirect_URI__c from Quickbook__c]
        
            clientid = qbcss.ClientId__c;
            clientSecret = qbcss.Clientsecret__c;           
            scope=qbcss.Scope__c;
            realmid=qbcss.realmid__c;
            redirecturi=qbcss.Redirect_URI__c; 
            
        
    }
    public  void firstButton()
    {
        firstPanel=true;
        secondPanel= true;
        thirdPanel = false; 
        
       // list<Quickbook__c> confList=[select id,ClientId__c,Clientsecret__c,Scope__c,realmid__c,Redirect_URI__c from Quickbook__c];
       Quickbook__c qbcss= Quickbook__c.getorgdefaults(); 
        clientid = qbcss.ClientId__c;
            clientSecret = qbcss.Clientsecret__c;           
            scope=qbcss.Scope__c;
            realmid=qbcss.realmid__c;
            redirecturi=qbcss.Redirect_URI__c; 
            
    }
    
     public  void secondButton(  )
    {
        firstPanel=false;
        secondPanel=false;
        thirdPanel = true; 
        
        
    }
    
    public void Cancel(){
        firstPanel = true;
        secondPanel = true;
        thirdPanel = false; 
        
    }
     public  void thirdButton()
    {
        firstPanel = true;
        secondPanel = false;
        thirdPanel = false;
        if(firstPanel == true){
            //Quickbook__c qbc=new Quickbook__c();
            Quickbook__c qbc=Quickbook__c.getorgdefaults();
            qbc.Name='ETG';
            qbc.ClientId__c=clientid;
            qbc.Clientsecret__c=clientSecret;
            qbc.Scope__c=scope;
            qbc.realmid__c=realmid;
            qbc.Redirect_URI__c=redirecturi;
            
            update qbc;
                      
        }
        
        else if(firstPanel != true){
        //Quickbook__c qbcs=new Quickbook__c();
            Quickbook__c qbcs=Quickbook__c.getorgdefaults();
                
            
            qbcs.Name='ETG';
            qbcs.ClientId__c=clientid;
            qbcs.Clientsecret__c=clientSecret;
            qbcs.Scope__c=scope;
            qbcs.realmid__c=realmid;
            qbcs.Redirect_URI__c=redirecturi;
            
            update qbcs;
            
             
        }               
            
    }
 
}
visualforce page
<apex:page controller="configpage" tabStyle="account" lightningStylesheets="true" showHeader="false" sidebar="false">
    <style type="text/css">
        .divclass{
        margin-left:350px;
        }
    </style>
    <apex:form style="font-size:15px;" id="all">
        <apex:pageBlock >
            <apex:pageBlockSection columns="1" title=" Configuration page" rendered="{!firstPanel}"  collapsible="false" >   
               
                <apex:outputPanel >
                    <div class="divclass">
                         
                    </div>
                </apex:outputPanel>              
            </apex:pageBlockSection>                   
            <apex:pageBlockSection id="sec"  columns="1" rendered="{!secondPanel}">
                
                <apex:outputText label="Api Key :" value="{!clientid}"/>
                <apex:outputText label="Api Secret :" value="{!clientSecret}"/>                
                <apex:outputText label="scope" value="{!scope}"/>
                <apex:outputText label="id" value="{!realmid}"/>
                <apex:outputText label="redirecturi" value="{!redirecturi}"/> 
                <apex:outputPanel >
                    <div class="divclass">
                        <apex:commandButton value="Edit" action="{!secondButton}"/> 
                      
                    </div>
                </apex:outputPanel>                
            </apex:pageBlockSection> 
  <apex:pageBlockSection columns="1"  id="third" rendered="{!thirdPanel}" >
                <apex:pageMessages ></apex:pageMessages>
                <apex:inputText value="{!clientid}" label="Api Key:" required="true" />
                <apex:inputText value="{!clientSecret}" label="Api Secret:" required="true"/>              
               <apex:inputText value="{!scope}" label="scope " required="true"/>
                <apex:inputText value="{!realmid}" label="realmid:" required="true"/>
                <apex:inputText value="{!redirecturi}" label="redirecturi:" required="true" style="width:600px;"/>
                <apex:outputPanel >
                    <div class="divclass">
                        <apex:commandButton value="Save" action="{!thirdButton}" reRender="all"/> 
                        <apex:commandButton value="Cancel" action="{!Cancel}"/>
                    </div>
                </apex:outputPanel>   
            </apex:pageBlockSection>                
        </apex:pageBlock>
    </apex:form>
</apex:page>
can any one help me ...
ShirishaShirisha (Salesforce Developers) 
Hi Srinivas,

Greetings!

You can check the sample code to redirect to the standard page in the below document from the Visualforce page:

https://developer.salesforce.com/forums/?id=906F00000008s2zIAA

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
David Zhu 🔥David Zhu 🔥
Would code below work for you?

public PageReference  thirdButton()
{
   ......................

return null;
}