0

I'am creating a custom lead conversion using Visualforce page. I'am getting this error for my lead owner lookup field. Can you help me why I'am having the value 1 in my lookup and how to fix this. TIA.

enter image description here

<apex:sectionHeader title="Lead Conversion" subtitle="{!leadName}" />
<apex:pageMessages />
<apex:form id="form">

    <apex:pageBlock title="Create Contact" mode="edit">

        <apex:pageBlockButtons location="bottom">
            <apex:commandButton value = "Convert" action="{!doEditLead}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockSection columns="1">                                
            <apex:inputField value="{!  leadRec.OwnerId}" label="Record Owner"/>                                
            <apex:selectList value="{!convertedAccount.Id}" size="1" label="Organisation Name">
                <apex:selectOptions value="{!accountSelections}" />
            </apex:selectList>                    
            <apex:selectList value="{!leadRec.Status}" size="1" label="Converted Status">
                <apex:selectOption itemValue="Validated" itemLabel="Validated"/>
            </apex:selectList>                                    
        </apex:pageBlockSection>                        
    </apex:pageBlock>       
</apex:form>             

CONTROLLER

public class LeadConversionCustomController {


public final Lead leadRec {get; set;} 
public Account convertedAccount {get; set;}

public LeadConversionCustomController(ApexPages.StandardController stdController){
    Id leadRecId = stdController.getRecord().Id;

    this.leadRec = [SELECT Id, Salutation, Name, FirstName, LastName, Company, Email, Phone, Job_Title_Generic__c, Department__c, Digital_Copy_Preffered__c,
                           Work_Address_Country_ASF__c, Work_Address_Street__c, Work_Address_Street_2__c, Work_Address_Street_3__c, Work_Address_City__c,
                           Work_Address_State_ASF__r.Name, Work_Address_Zip_Postal_Code__c, OwnerId, Status, Institutional_Staff_Profile_URL__c
                    FROM Lead 
                    WHERE Id =: leadRecId];

this.convertedAccount  = new Account();
}        

}

3
  • 2
    Without seeing your controller, no, we can't. Presumably, you tried to put a Name where an Id should be.
    – sfdcfox
    Apr 11, 2020 at 3:24
  • What do you see in the stack trace / the logs? Apr 11, 2020 at 9:31
  • 1
    accountSelections is not in the controller/extenstion. That one should have a value as valid record ID
    – kurunve
    Apr 11, 2020 at 9:36

0

You must log in to answer this question.