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
ckumckum 

Retreive Lookup Id from the standard field even after I change the value.

Hello All,

 

I have a query on a lookup field of InputField type. Where I am setting a default value from the URL. In the Url I also have the ID of the default value. ON the VF page, I can change the value in the lookup, but I am only able to retreive the Names and not the Id of the particualr value. Kindly suggest some way to retreive the id of the values changing in lookup.

 

Thanks

ckum

bob_buzzardbob_buzzard
What field are you backing the inputfield with?  If its a lookup field (i.e. the id), the name will be displayed on the screen but the underlying id should also be updated.
ckumckum

Hi, Thanks for the reply. I have two field one is related to Account lookup and other to Contact lookup.

<apex:inputField id="txtQuoteContactName" value="{!INFW_Quote__c.Quoted_Contact__c}" style="align:left;width: 100px" onBlur="javascript: onChangeqContname();" />

 

<script>

var quoteContactId;function onChangeqContname()

{

 

quoteContactId = document.getElementById('{!$Component.txtQuoteContactName}').value;

alert(quoteContactId);

}

 

Here the alert gives me the name. I need 'Id' for this.

 

Thanks,

ckum

bob_buzzardbob_buzzard
Have a dig around in the source of the page.  There will be a hidden input field near your name field that is used to hold the id of the selected lookup value.