• Ivica Arsenov
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello guys.I have a problem and dont know how to solve it.What i need to make is to split account creation page in 3-4 visualforce pages.Now i created the first page and linked it with a second page with a button.But now the problem is when i press the "next" button on the first page account is created, and the fields in the second page are not recorded anywhere when i push the "next" button(on the second page). I dont know how to update the account that was created on the first page with the values that i enter in the second page so here is the code:
this is my custom controller:
public class SetupWizard {
public Account account {get;private set;}
     
    public SetupWizard(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        account = (id == null) ? new Account() : 
            [SELECT Name, Phone, Industry FROM Account WHERE Id = :id];
    }
   
    public PageReference save() {   
            try{
                upsert account;
                }catch(exception e){
                }
                PageReference page = new Pagereference('/apex/AddressInformation');
            page.setRedirect(true);
            return page;
 }
}
and this is the first visualforce page:
<apex:page sidebar="false" controller="SetupWizard" tabStyle="Account">
    <apex:form >
        <apex:pageBlock title="Account Information" >
            <apex:pageBlockSection columns="2">
                <apex:inputField value="{! Account.name }" />
                <apex:inputField value="{! Account.phone}" />
                <apex:inputField value="{! Account.industry}" />
                </apex:pageBlockSection>
                
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Next" 
                                    action="{! save }"/>    
            </apex:pageBlockButtons>
           </apex:pageBlock>
    </apex:form>
</apex:page>
So how to make when press the next button on the second page it updates the account created on the first page with the records that are eneterd on my second page.Any help would be nice thx.

 
Hello guys.I have a problem and dont know how to solve it.What i need to make is to split account creation page in 3-4 visualforce pages.Now i created the first page and linked it with a second page with a button.But now the problem is when i press the "next" button on the first page account is created, and the fields in the second page are not recorded anywhere when i push the "next" button(on the second page). I dont know how to update the account that was created on the first page with the values that i enter in the second page so here is the code:
this is my custom controller:
public class SetupWizard {
public Account account {get;private set;}
     
    public SetupWizard(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        account = (id == null) ? new Account() : 
            [SELECT Name, Phone, Industry FROM Account WHERE Id = :id];
    }
   
    public PageReference save() {   
            try{
                upsert account;
                }catch(exception e){
                }
                PageReference page = new Pagereference('/apex/AddressInformation');
            page.setRedirect(true);
            return page;
 }
}
and this is the first visualforce page:
<apex:page sidebar="false" controller="SetupWizard" tabStyle="Account">
    <apex:form >
        <apex:pageBlock title="Account Information" >
            <apex:pageBlockSection columns="2">
                <apex:inputField value="{! Account.name }" />
                <apex:inputField value="{! Account.phone}" />
                <apex:inputField value="{! Account.industry}" />
                </apex:pageBlockSection>
                
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Next" 
                                    action="{! save }"/>    
            </apex:pageBlockButtons>
           </apex:pageBlock>
    </apex:form>
</apex:page>
So how to make when press the next button on the second page it updates the account created on the first page with the records that are eneterd on my second page.Any help would be nice thx.