How to create custom salesforce lookup


Originally posted on Bartosz Michał Borowiec:
var b = document.getElementById(‘{!$Component.BI_Insurance_gne}’ + ‘_lkwgt’); if (b != null) { b.onclick = function(){ lookupPick(‘editPage’,'{!$Component.Plan_Plan_Product_lookup_gne}_lkid’, ‘{!$Component.Plan_Plan_Product_lookup_gne}’, ”,”,”,’null’,”); openLookup(‘/apex/GNE_CM_Insurance_lookup_page?lkfm=editPage&patientID={!Benefit_Investigation_gne__c.Patient_BI_gne__c}&productID={!Benefit_Investigation_gne__c.Product_BI_gne__c}&lknm={!$Component.BI_Insurance_gne}&lktp=’ + document.getElementById(‘{!$Component.BI_Insurance_gne}_lktp’).value,670,document.getElementById(‘{!$Component.BI_Insurance_gne}_mod’).value,’&lksrch=’ +…