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
Proposal ButtonProposal Button 

lead conversion page convert button not working

Hi All

 

I am trying to convert the lead to opportunity and there are many custom fields required in the convert page. so i written a vf page to include all my custom fields in the page. the issue i am facing is i want the Account to be lookup in the VF page and the convert button is not working with the code i written in the VF page. please have a look at my VF page and the apex class i written for this task. appreciate for all your help

 

VF Page:

 

<apex:page standardController="lead" tabStyle="Lead" extensions="leadController" >
<apex:messages />
<apex:sectionHeader title="Convert Lead"/>
<apex:form >
<apex:pageBlock mode="Edit">
<apex:pagemessages />
<apex:pageBlockSection title="Convert Lead">
         <apex:pageBlockSectionItem >
            <apex:outputLabel value=" Record Owner" for="Record Owner"/>
            <apex:inputField value="{!Lead.OwnerID}"/>
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
           <apex:OutputLabel for="Send Email to the Owner">Send Email to the Owner:</apex:OutputLabel>
           <apex:inputCheckbox onclick=""/>
           </apex:pageBlockSectionItem>            
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Account Name">Account Name</apex:outputLabel>
             <apex:inputField id="Owner" value="{!Lead.Company}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Oppt Name">Opportunity Name:</apex:outputLabel>
             <apex:inputField id="Owner" value="{!Lead.Company}" />
          </apex:pageBlockSectionItem>
          <apex:pageblockSectionItem >
          <apex:outputLabel for="no oppty">Do not create new opportunity upon conversion</apex:outputLabel>
          <apex:inputCheckbox onselect=""/>
          </apex:pageblockSectionItem>
          <apex:pageBlockSectionItem >
                      <apex:outputLabel for="ConStatus">Converted Status:</apex:outputLabel>
             <apex:inputField id="ConStatus" value="{!Lead.Status}" />
          </apex:pageBlockSectionItem>
          </apex:pageBlockSection>         
<apex:pageBlockSection title="Address Information" columns="2" id="AddressInformation">
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="StreetAdd">Street Address:</apex:outputLabel>
          <apex:inputField Id="StreetAdd" Value="{!Lead.Street}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="City">City:</apex:outputLabel>
          <apex:inputField Id="City" Value="{!Lead.City}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="State">State:</apex:outputLabel>
            <apex:inputField Id="State" Value="{!Lead.State}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Zip">Postal Code:</apex:outputLabel>
            <apex:inputField Id="Zip" Value="{!Lead.PostalCode}" />
          </apex:pageBlockSectionItem>                    
          </apex:pageBlockSection>
 <apex:pageBlockSection title="Additional Information" columns="2" id="AdditionalInformation">
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="NoofEmp">No. Of Employees:</apex:outputLabel>
            <apex:inputField Id="Owner" Value="{!Lead.NumberOfEmployees}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Revenue">Annual Revenue:</apex:outputLabel>
                <apex:inputField Id="Revenue" Value="{!Lead.AnnualRevenue}" />      
                      </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Industry">Industry:</apex:outputLabel>
           <apex:inputField Id="Industry" Value="{!Lead.Industry}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Description">Description:</apex:outputLabel>
            <apex:inputField Id="Description" Value="{!Lead.Description}" />
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Website">Website:</apex:outputLabel>
          <apex:inputField Id="Website" Value="{!Lead.Website}" />
          </apex:pageBlockSectionItem>  
          </apex:pageBlockSection>                                   
<apex:pageBlockSection title="Task Information" columns="2" id="TaskInformation">
          
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="Subject">Subject</apex:outputLabel>
            <apex:inputField value="{!Task.Subject}"/>
          </apex:pageBlockSectionItem>
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="Status">Status</apex:outputLabel>
            <apex:inputField value="{!Task.Status}"/>
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="DueDate">Due Date</apex:outputLabel>
            <apex:inputField value="{!Task.ActivityDate}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Priority">Priority</apex:outputLabel>
            <apex:inputField value="{!Task.Priority}"/>
          </apex:pageBlockSectionItem>
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="EndDate">Completed Date:</apex:outputLabel>
          </apex:pageBlockSectionItem>
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="Followupdate">Followup Date:</apex:outputLabel>
          </apex:pageBlockSectionItem>
          </apex:pageBlockSection>      
<apex:pageBlockSection title="Description Information" columns="1" id="DescriptionInformation">
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="Sub">Subject:</apex:outputLabel>
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="Comments">Comments</apex:outputLabel>
            <apex:inputField value="{!Task.Description}"/>
          </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel for="ExtDescription">Extended Description:</apex:outputLabel>
          </apex:pageBlockSectionItem>
          <apex:pageBlockSectionItem >
          <apex:OutputLabel for="Send Notification Email">Send Notification Email:</apex:OutputLabel>
           <apex:inputCheckbox onclick=""/>
           </apex:pageBlockSectionItem>
          </apex:pageBlockSection>    
<apex:pageBlockButtons >  
        <apex:commandButton value="Convert"/>
        <apex:commandButton Action="{!Cancel}" value="Cancel"/>
         </apex:pageBlockButtons>                                     
          </apex:pageBlock>  
</apex:form>               
</apex:page>
Class:

 
public class leadController {
        
public leadController(ApexPages.StandardController controller) {
}
public Task getTask(){
    Task tsk = new Task();
    return tsk;
}
    
}

 

bob_buzzardbob_buzzard

Your command button doesn't actually do anything:

 

 

<apex:commandButton value="Convert"/>

 

 

doesn't specify an action method, so it simply tells the page to refresh.

 

If you want your account field to be a lookup to an account, you'll have to back it with an sobject field that is a lookup to an account.  What you have at the moment:

 

 

<apex:inputField id="Owner" value="{!Lead.Company}" />

 

Is backed by Lead.Company, which I believe is an sobject text field.

 

krishna3krishna3

Can you please suggest me some code for convert button and lookup for an account 

 

thanks,

harish r 20harish r 20
hiii 
 but i want to create only contact what can i do ?