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

Can anyone explain these parameters?

javascript: openLookup('/_ui/common/data/LookupPage?lknm=CF00N30000001BYw0&lkfm=editPage&lktp=' + document.getElementById('CF00N30000001BYw0_lktp').value,670,document.getElementById('CF00N30000001BYw0_mod').value,'&lksrch=' + escapeUTF(document.getElementById('CF00N30000001BYw0').value),'maxw')
Ron HessRon Hess
I'll take a stab at it, i've used most of these in one scontrol or another

lknm  -- looks like a custom field id ( input element in the document.element... )
lkfm=editPage  name of the form ( document.editPage)
ktp == type of the object to view in the lookup list ( three char prefix)
lksrch == search string to put into the lookup input box

all of these are input / ouput params to the common/data/LookupPage  servlet

they work to enable a popup, lookup box.  One of those params is where the lookup box should put the chosen object, which one?
well without looking at the source for openLookup() , i'd guess it's the form name + lknm

To get to the bottom of this , look at the source for openLookup(), it's in one of the javascript files included in the page this code came from.

What about _lspf? any clue what that is?

Are these prefix reliable? Is it safe for me to use the openLookup function?
Ron HessRon Hess
I dont' know what _lspf does.

yes you can use openLookup() , I do in several of the S-Controls on the AppExchange.
try this in an scontrol
you need a form called "editPage", the final account ID ( after user picks one) is left in tsk3_lkid
you can remove the
I ignore the other paramaters (some of which I don't understand)

 <TD class="labelCol  ">
 <label for="tsk13" id="account_label">Account</label></TD>
 <td class="dataCol col02" >
  <input name="tsk3_lkid" id="tsk3_lkid" value="{!Account_Id}" type="hidden">
  <input name="tsk3_lkold" id="tsk3_lkold" value="" type="hidden">
  <input name="tsk3_lktp" id="tsk3_lktp" value="001" type="hidden">
  <input name="tsk3_lspf" id="tsk3_lspf" value="0" type="hidden">
  <input name="tsk3_mod" id="tsk3_mod" value="0" type="hidden">
  <span class="lookupInput">
  <input tabindex="30" maxlength="80" title="Related To" 
   onchange="document.getElementById('tsk3_lkid').value='';document.getElementById('tsk3_mod').value='1';" id="tsk3" size="20" name="tsk3" 
   type="text"><a title="Related To Lookup (New Window)" 
   href="JavaScript: openLookup('/_ui/common/data/LookupPage—lknm=tsk3&lkfm=editPage&lkrf=&sn=1&lktp=' + document.getElementById('tsk3_lktp').value,670,document.getElementById('tsk3_mod').value,'&lksrch=' + escapeUTF(document.getElementById('tsk3').value),'maxw')" tabindex="31" onclick="setLastMousePosition(event)" id="whtbtn"><img src="/s.gif" alt="Related To Lookup (New Window)" class="lookupPopup"></a></span><span class=errorMsg id="errorMsgAccount"></span>


I have the openLookup() URL parameters working, however, I was looking to refine my search a bit.  Do you know of any way that I can drill down further and sort my lookup options?

Thanks for your time.



Hoping you might be able to help, as this post is the closest thing I've found to what I'm trying to do.


I'd like to build a custom page for our opportunity capture, where I present the sales user with a simplified page with the mandatory fields required for the product they are selling.


As part of this, I will need multiple lookups to allow them to complete the record correctly. For example, one of these lookups may be to the account, one may be to the opportunity contact of a certain type. I may also need repeating lookups for each of the product line items on the opportunity.


Im trying to understand the best way to incorporate a lookup field in my page. As my lookups are across multiple objects, I'm using a custom controller instead of an extension. In this I am querying all of the data I need and referencing the fields directly:


<apex:inputField value="{!opportunity.AccountId}" />


<apex:repeat value="{!lineItems}" var="item" >

<apex:inputField value="{!item.Site__c}" />




The problem with this method is how to update the fields when the user saves the form, as they are not bound to a variable in the controller?


So I'm thinking I need to do something a little more custom and use the openLookup function for each of my required lookups, and then pass the selected IDs to the controller using hidden parameters.


You mentioned that the selected ID from the lookup gets set into the 'tsk3_lkid' field. How would I do something similar with multiple lookups?


Hopefully I'm making sense and you can point me in the right direction.


All the best,