+ Start a Discussion
arunadeveloperarunadeveloper 

I am able to get the name but not id from look up can any suggest me it very urgent prod problem

Below code will create the contact look up on vf page.

I am able to get the name of the contact but not the id.

problem is ,  if 30 contact are having same name with different account names.

when i look for one contact and search it is bringing all the 3o contatcs with different accounts.

i know the proble  or mistake i am making, i am using contact name as where clus in the query.

i think i sholud be on based on id instead of name.

can any please suggest me how can i get the id for below look up code .

 

 

 

 

 

<apex:OutPutPanel id="contactlookupPanel" >
<apex:OutPutPanel rendered="{!displayLookup}">
Contact &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="hidden" name="testlookup_lkid" id="testlookup_lkid" value="000000000000000" />
<input type="hidden" name="testlookup_lkold" id="testlookup_lkold" value="" />
<input type="hidden" name="testlookup_lktp" id="testlookup_lktp" value="003" />
<input type="hidden" name="testlookup_lspf" id="testlookup_lspf" value="3" />
<input type="hidden" name="testlookup_lspfsub" id="testlookup_lspfsub" value="0" />
<input type="hidden" name="testlookup_mod" id="testlookup_mod" value="0" />

<span class="lookupInput">
<input autocomplete="off" id="testlookup" value="{!contactLookUp}" maxlength="255" name="testlookup" onchange="getElementByIdCS('testlookup_lkid').value='';getElementByIdCS('testlookup_mod').value='1';" size="20" tabindex="4" type="text" />
<a href="javascript&colon;%20openLookup%28%27%2F_ui%2Fcommon%2Fdata%2FLookupPage%3Flkfm%3DeditPage%26lknm%3Dtestlookup%26lktp%3D%27%20%2B%20getElementByIdCS%28%27testlookup_lktp%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27testlookup%27%29.value.substring%280%2C%2080%29%29%29" id="con4_lkwgt" onclick="setLastMousePosition(event)" tabindex="4" title="Contact Name Lookup (New Window)">
<img src="/s.gif" alt="Customer Name Lookup (New Window)" class="lookupIcon" onblur="this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Customer Name Lookup (New Window)" />
</a>
</span>
<apex:commandButton value="OK" onclick="contactName();" rerender="contactlookupPanel">
<apex:actionFunction name="getContactName12" action="{!getContactName}" rerender="contactpageblock">
<apex:param name="contNameLkpParam" assignTo="{!contNameLkpParam}" value="{!contactLookUp}" id="conid2param"/>
</apex:actionFunction>
</apex:commandButton>

Sonam_SFDCSonam_SFDC
Hi Aruna,

When you implement a lookup - the user is supposed to enter the name(first name /last name) however I am not able to get your idea of searching using the Contact ID.

Are you saying that the user will be entering the ID such that only a single contact is found.