You need to sign in to do that
Don't have an account?
Sujata Tiwari 3
When click on Save, my lead records should creates.
Hi All,
I am giving inputs at run time, after hitting save button my records should get saved and display the record detail page. Here, I am using Standardcontroller = 'Lead'
<apex:page standardController="Lead" extensions="TrialReController" sidebar="false" showHeader="false">
<apex:form id="frm">
<apex:pageblock>
<apex:pageblockButtons location="bottom">
<apex:commandButton value="Save" action="{!Save}" rendered="true" />
</apex:pageblockButtons>
<apex:pageblocksection columns="1">
<apex:inputfield value="{!lead.FirstName}"/>
<apex:inputfield value="{!lead.lastname}"/>
<apex:inputfield value="{!lead.Phone}"/>
<apex:inputfield value="{!lead.Email}"/>
<apex:inputfield value="{!lead.Account__c}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
********************************************************
public class TrialReController {
public boolean x{get;set;}
public boolean y{get;set;}
public Lead lead{get;set;}
public TrialReController(ApexPages.StandardController controller) {
Lead lead = new Lead();
}
public void Save(){
insert Lead; //used upsert also, still not working
//return new PageReference('/'+Lead.Id);
}
}
I am not able to save my records its throwing error :
Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page trialredesign: Class.TrialReController.Save: line 29, column 1
Many many thanks for your help..!!
I am giving inputs at run time, after hitting save button my records should get saved and display the record detail page. Here, I am using Standardcontroller = 'Lead'
<apex:page standardController="Lead" extensions="TrialReController" sidebar="false" showHeader="false">
<apex:form id="frm">
<apex:pageblock>
<apex:pageblockButtons location="bottom">
<apex:commandButton value="Save" action="{!Save}" rendered="true" />
</apex:pageblockButtons>
<apex:pageblocksection columns="1">
<apex:inputfield value="{!lead.FirstName}"/>
<apex:inputfield value="{!lead.lastname}"/>
<apex:inputfield value="{!lead.Phone}"/>
<apex:inputfield value="{!lead.Email}"/>
<apex:inputfield value="{!lead.Account__c}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
********************************************************
public class TrialReController {
public boolean x{get;set;}
public boolean y{get;set;}
public Lead lead{get;set;}
public TrialReController(ApexPages.StandardController controller) {
Lead lead = new Lead();
}
public void Save(){
insert Lead; //used upsert also, still not working
//return new PageReference('/'+Lead.Id);
}
}
I am not able to save my records its throwing error :
Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page trialredesign: Class.TrialReController.Save: line 29, column 1
Many many thanks for your help..!!
Moreover ensure all the required fields are represented I think you missed Company
Is your query solved.if yes mark this thread closed.