Skip to main content
Hi Friends,

I am Updating a  record using Visualforce page. When I enter all the data into  visualforce page, Here i need to perform 2 actions.

1) Save the record

2) Open a link

I tried it using page reference(), but struck at some point.

<apex:commandButton value="Save" action="{!Save}" /> 

Controller ::

public class rerender {

        public Account acc {get;set;}

    public rerender(ApexPages.StandardController controller) {

 

    }

    public PageReference save(){

       

        PageReference reRend = new PageReference('/apex/ThankYou');

        reRend.setRedirect(false);

        return reRend; 

    }

}

In this, i was unable to save the record, but was able to open the link.

How to achieve this...!

 
3 answers
  1. Jun 2, 2016, 2:07 PM
    Hi ,

    Yes we can create a custom button which can perform multiple action. I just tested it in dev console.

    You are missing the DML statement here in the save method.Use Insert,Update or (insert and update both ) based on your requirement.

    Please comment if you find this helpful.Thanks!!!.

    public PageReference save(){

    Upsert acc;

    PageReference reRend = new PageReference('/apex/ThankYou');

    reRend.setRedirect(false);

    return reRend;

    }

     
0/9000