Since loading large numbers of records proved impossible, I’ve updated my jQuery autocomplete integration to perform an Ajax call and retrieve associated records on key press.

Benefits:

(1) Live Ajax autocomplete on any object
(2) Easy to use
(3) Easily themable with jQuery Themeroller
(4) Easily customizable (implementation is open source)
(5) Can provide a filter

Usage:

<c:enhancedLookup pageController="{!this}" fieldName="Test_Lookup_Object__c" objectToLookup="TestLookupObject__c" bigset="true" />

Defaults are:

(1) 2 characters must be typed in before the call
(2) Call with ‘LIKE’ as specified in Abhinav Gupta’s helpful post on the subject
(3) Lookup on 8 elements while the string is under 3 characters and 100 after this

To provide a filter pass a filter string in SOQL format such as the following:

<c:enhancedLookup pageController="{!this}" fieldName="Test_Lookup_Object__c" objectToLookup="TestLookupObject__c" bigset="true" filterString="WHERE type__c !=  'Bear'" />

I’ve added this and numerous other enhancements to the jQuery for Salesforce library at Google Code.

I’ve also added the controller to my library on Snipplr for reference.

About these ads