+ Start a Discussion
test batchtest batch 

Save button is not navigating ..?

public pagereference dosave(){
    
                      
        try { 
            upsert objInvoices;
        }
         catch (DMLException dmlExcp) {
            ApexPages.addMessages(dmlExcp);
        }
        
       //  PageReference redirectSuccess = new ApexPages.StandardController('/'+objInvoices.id).view();
       // return (redirectSuccess);

        pageReference pr2=new pagereference('/'+objInvoices.id).setredirect(true);
        return pr2;
        
    }

 
Best Answer chosen by test batch
Andrew EchevarriaAndrew Echevarria
Try removing reRender parameter. If it's redirecting, it will rerender anyway?

All Answers

Andrew EchevarriaAndrew Echevarria
Have you tested it in a test class? Check if the method itself works in a test class by checking if the pageref value changes. Otherwise, the issue may be in your VF page and not your controller.
test batchtest batch
<apex:commandbutton value="Save" action="{!dosave}" status="actStatusId1" reRender="stus,invoices,messages" style="background:LightBlue;width:150px;"/>
Andrew EchevarriaAndrew Echevarria
Try removing reRender parameter. If it's redirecting, it will rerender anyway?
This was selected as the best answer
test batchtest batch
dint write test class yet .. will start if it's working well