+ Start a Discussion
padmaja shivanepadmaja shivane 

how to map dropdown field to lookupfield in vf

Shashikant SharmaShashikant Sharma
You could use selectList in Visualforce.

<apex:selectOptions value="{!options}"></apex:selectOptions>

Read this : http://www.oyecode.com/2013/01/how-to-render-lookup-field-as-picklist.html

Please mark this as solution if it helps you so that others could be benifitted from it.

Abhinav MIshraAbhinav MIshra
public with sharing class yourController
    // Defining objects
    public User selectedUser { get; set; }
    public Order__c order { get; set; }

    // Constructor where the user data will be pre-populated
    public yourController()
        order = new Order__c();
        order.User__c = UserInfo.getUserId();
        selectedUser = [ Select Id, Email, Phone From User Where Id = :UserInfo.getUserId() ];

    // Method for reading selected user data
    public pageReference readUser()
        selectedUser = [ Select Id, Email, Phone From User Where Id = :order.User__c ];
        return null;
<apex:outputPanel id="userDetails">
        <apex:pageBlockSection columns="1">
            <apex:inputField value="{!order.User__c}">
                <apex:actionSupport event="onchange" action="{!readUser}" reRender="userDetails"/>
            <apex:outputField value="{!selectedUser.email}"/>
            <apex:outputField value="{!selectedUser.phone}"/>

Reetesh Makkar