Search code examples
htmlhyperlinkapex-code

Open another apex page on save button click - apex


I am fresher in apex. I have one sample form in which i am having three fields and one button. I want to open another page on button click. Can you please guide me?

Thanks in advance.


Solution

  • PageReference Class

    public PageReference save() {
            // Add the account to the database. 
            insert account;
            // Send the user to the detail page for the new account.
            PageReference acctPage = new ApexPages.StandardController(account).view();
            acctPage.setRedirect(true);
            return acctPage;
        }