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
Dheeraj-(DJ)Dheeraj-(DJ) 

Hi Team, I am new to development. I have created a VF page which is not saving the Lead details once I hit the save button. Please help!

<apex:page standardController="Lead">
<apex:form >
<apex:pageBlock title="New Lead">
   <apex:pageBlockSection columns="2">
     <apex:inputtext value="{!Lead.Name}" label="Name"/>
     <apex:inputfield value="{!Lead.Email}" label="Email"/>
     <apex:inputfield value="{!Lead.Status}" label="Status"/>
     <apex:inputfield value="{!Lead.MobilePhone}" label="Mobile Phone"/>
     <apex:inputfield value="{!Lead.Company}" label="Company Name"/>
     <apex:inputfield value="{!Lead.AnnualRevenue}" label="Annual Revenue"/>
     <apex:inputfield value="{!Lead.Fax}" label="Fax"/>
     <apex:inputfield value="{!Lead.Title}" label="Title"/>
     <apex:inputfield value="{!Lead.Website}" label="Website"/>
   </apex:pageBlockSection>
   
   <apex:pageBlockButtons >
      <apex:commandButton action="{!Save}" value="Save"/>
      <apex:commandButton action="{!Cancel}" value="Cancel"/>
      <apex:commandButton action="{!Edit}" value="Edit"/>
      <apex:commandButton action="{!View}" value="View"/>
      <apex:commandButton action="{!Delete}" value="Delete"/>
   </apex:pageBlockButtons>
   
</apex:pageBlock>
<apex:detail relatedList="true"/>
 </apex:form>
</apex:page>
Best Answer chosen by Dheeraj-(DJ)
Krishnamoorthi PeriasamyKrishnamoorthi Periasamy
Require field (Last name) is missing. please add Last Name in VF page and try again.

Thanks Krishna

All Answers

Krishnamoorthi PeriasamyKrishnamoorthi Periasamy
Require field (Last name) is missing. please add Last Name in VF page and try again.

Thanks Krishna
This was selected as the best answer
Krishnamoorthi PeriasamyKrishnamoorthi Periasamy
Did  abovet answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Dheeraj-(DJ)Dheeraj-(DJ)
Great! It is working now. It means all required fields need to be there. 
Thanks Krishnamoorthi. Thanks a lot!
Hare Krishna :)
Sharankumar DesaiSharankumar Desai
Hi Deeraj,

Instead of using 
<apex:inputtext value="{!Lead.Name}" label="Name"/>

Use below

 <apex:inputtext value="{!Lead.FirstName}" label="FirstName"/>
 <apex:inputtext value="{!Lead.LastName}" label="LastName"/>

--
Regards
Sharan Desai
+91 966 33 11 740
Dheeraj-(DJ)Dheeraj-(DJ)
Thank You Sharan! My code is working. :)