You need to sign in to do that
Don't have an account?

update same object from different VisualForce pages
I have a requirement to design VF pages so that each field in custom object is on a different page.
I have used PageReference in apex class that saves the data and navigates to next object.
Problem i am facing, is the save is creating new instance of the object instead of updating.
Please provide a way to update the same instance of the object before navigating to next page.
I have used PageReference in apex class that saves the data and navigates to next object.
Problem i am facing, is the save is creating new instance of the object instead of updating.
Please provide a way to update the same instance of the object before navigating to next page.
public with sharing class ADDRESSNEXT {
public list <Objection__c> lead {get;set;}
ApexPages.StandardController stdController;
public ADDRESSNEXT (ApexPages.StandardController con){
stdController = con;
}
public PageReference saveandcity() {
stdController.save();
PageReference pg = Page.parkbepcity;
pg.setredirect(true);
return pg;
}
public PageReference saveandTeleworkDays() {
stdcontroller.save();
PageReference pg = Page.ParkBepTeleworkstatus;
Return pg;
}
}
First page
<apex:page showHeader="true" sidebar="true" standardController="objection__c" EXTENSIONS="ADDRESSNEXT">
<apex:form ID="Member">
<apex:outputLabel value="Primary Member" for="Primary Member"/>
<apex:inputtext required="true" label="Member" value="{!Objection__c.Primary_Member__c}" />
<br/>
<apex:commandButton value="Next" action="{!saveandCity}" id="submit"/>
</apex:form>
</apex:page>
Second page
<apex:page showHeader="true" sidebar="true" standardController="Objection__c" EXTENSIONS="ADDRESSNEXT">
<apex:form ID="State">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:outputLabel value="State" for="State"/>
<apex:inputfield required="false" label="State" id="State__c" value="{!objection__c.State__c}"/><br/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:commandButton value="Next" action="{!saveandTeleworkDays}" id="submit"/>
</apex:form>
</apex:page>