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
Shwetal DesaiShwetal Desai 

Create Lookup input field in visual force page dynamically

In salesforce, normally when we create a custom field, we select "lookup" field type and assign a reference object to that field from where we choose a record.
My problem is... i want to assign a reference object to a lookup field dynamically [through codding.. in my visual force page].
Is it possible to assign a reference object dynamically to a lookup custom field?
Shwetal Desai
You should be able to do this in a visualforce controller.  Just assign a valid Id to the Lookup field:

object.lookupfield__c = my_valid_id;





I am also need the same requirement. I want to create the look up field in visual force page with out using the back end field. how to write the controller and which data type can i use. Please help me how to solve thses. Its very urgent requirement for me. Thanks in advance.