You need to sign in to do that
Don't have an account?
Rakesh Kumar
Capture Lookup value in Apex controller
Hi All,
I would like to capture the lookup field value in the apex controller.
VF page
<apex:inputField value="{!Object__c.lookupFiled__c}"/>
Apex controller..
here i am getting the lookup value as ID but i want to get it as value(Text).
Is there any way that we can get it on apex controller.
Thanks
Rakesh
Hi Rakesh,
Try below :-
<apex:inputField value="{!Object__c.lookupFiled__r.name}"/> //where name is the field we want to access
You will have to store the text in some hidden field on page or Query for the Name in the controller.
1. First one can be done as:
Page:
Controller:
2. In the Second one the controller will look like
Please give KUDOS if it helps you.
Regards,
Lakshman
you always get Id in lookup , Simply create a formula field with name and show it on page ,and give a custom look up to the field
@vijit Capgemini developer
Lakshman
It helped me too much in such a thing i was spending too much time
Best regards!!!