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
justin brown 7justin brown 7 

Controller Extension

Hi all,
I have created a controller extension class as a work around to the approval processs for my visualforce page. This extension is suppsoed to update the status picklist field when the submit button is clicked and update the record if the record had been perviously saved but not submitted. However when I click the button it simply refreshes the page with no field update and no save. Any feedback on what I'm doing wrong?

VF Page Button:

<button class="btn waves-effect waves-light" type="submit" name="action">Submit
       <apex:commandButton action="{!setStatus1}" reRender="status"/>
               <i class="material-icons right">send</i>                                                                                
   </button>     
Controller Class:

public with sharing class ApprovalProcessExtension {
    
    private ApexPages.StandardController standardController;
    public CIOA_Submissions__c subs {get; set;}
    public ApprovalProcessExtension(ApexPages.standardController stdController){
        subs=(CIOA_Submissions__c) stdController.getRecord();
    }
    
    public pageReference setStatus1() {
        subs.Submission_Status__c = 'Pending';
        update subs;
        system.debug('setStaus1'); 
        return null;
    }
    public pageReference setStatus2() {
        subs.Submission_Status__c = 'Long Form';
        update subs;
        return null;
    }
     public pageReference save(){
      pagereference pref = new pagereference('/apex/CIOA_Nominations');
        pref.setRedirect(true);                
        return pref;
     }  
}
VineetKumarVineetKumar
Check your debug logs, you may get some clue from there in case of any error.
Also, you can put a system debug statement after your update operation and check if it actually got updated or not.