function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Money Care 7Money Care 7 

Vf page not working for upsert..

Hi All
I am facing one issue for long time.i have a standard object (Lead) and having standard and custon field.i have created a 4 Vf pages based on lead field ie leadpage1,leadpage2,leadpage3,leadpage4.when i am entering leadpage1 and click save it is saving and goes to leadpage2,if i am entring details in leadpage2 and click save it should be upsert .but it is not working.
public class Upsert1
{
    public Lead leadRec{get; set;}
    public Upsert1()
    {
        leadRec= new Lead();
    }
    
    public PageReference cancel() 
    {
        return null;
    }


    public PageReference save() 
    {
        return null;
    }

    
    public void saveAndContinue()
    {
    
        upsert leadRec Lead.Fields.Lead_No_new__c;
        
    }
}
<apex:pageblocksection title=" Information" showheader="true" columns="2">
                  <apex:inputfield value="{!leadRec.Entry_By__c}" />
                  <apex:inputfield value="{!leadRec.Campaign_If_any__c}" />
                   <apex:inputfield value="{!leadRec.Lead_Status__c}" />
                     <apex:inputfield value="{!leadRec.Lead_Type__c}" />
                  
                      <apex:inputfield value="{!leadRec.Nationality__c}" />
                      
                        <apex:inputfield value="{!leadRec.Age_Group__c}" />
                       
                             <apex:inputfield value="{!leadRec.Residency_Status__c}" />
                               <apex:inputfield value="{!leadRec.Religion__c}" />
                                 <apex:inputfield value="{!leadRec.Gender__c}" />

  </apex:pageblocksection>