Lookup Searches Functionality

In the Winter 14 release of Salesforce they enabled “Search All Fields” as long as enhanced lookup was enabled. This is extremely helpful when you have chosen to go with auto-numbering of your records. Instead of trying to gues what some nebuluous number is you can actually search for a field name. In Skuid it appears that it can only search for the number in the reference field (in my case a child relationship). Is there anyway to have SKUID do seach all funtionality so the user can enter something that makes sense to them in the field? Or is there a work around that people were using pre-release of the new feature?

You can specify other fields as the display template and lookup search results by going to a field’s “Advanced” properties and modifying the Display Template. The Display Template governs both what information about the related/lookup record is displayed, as well as which fields are searched by the autocomplete search. So for instance, here we have a Contacts table. Rather than the AccountId field, a lookup to the Account object, just showing the Account’s Name and letting us search on Name, we’d like it to let us search on Account Name and BillingCountry. To do this, we will modify the Display Template to include both Name and BillingCountry: Notice that our Display Template is “{{Name}} - {{BillingCountry}}”, and that Tokenize Autocomplete Search is enabled. These two options, used in conjunction, do several things for us:

  • When we start entering text into our Autocomplete, matching Account records will be displayed not just as the Account Name, e.g. “Genepoint”, “Acme”, but as the Account Name and BillingCountry, separated by a dash, e.g. “Genepoint - US”, “Acme - CAN” (assuming that there is data for this information in each Account record).
  • When we enter search text, e.g. “Gene”, this information will be searched separately in the Account Name and BillingCountry fields. So if we entered “Gene US”, our search phrase would be “tokenized” on the space character, giving us two unique search terms: “Gene”, “US”, which are separately matched against the two search fields that Skuid parses/derives from the Display Template: Name, BillingCountry. Therefore if there is an Account called “Genepoint” with a BillingCountry “USA” or “US”, this Account will be found.
  • The one other crucial thing here is that for this to work, you have to go into your Contacts Model, and ensure that the Account.Name and Account.BillingCountry fields are both in your Model — you will not be able to search or display these related fields unless they are in your Model. So notice that in our Contacts Model, after navigating into the AccountId relationship, we are requesting the following related fields as well: Because we have requested these fields in our Model, they will be available when we go to pick fields to insert using our Template field picker:

This worked perfectly and made the field even more valuable then the standard lookup. For instance, my Object was Medications. The record is set to autonumber so the numbers do not mean anything when they come up in the search. Some people search the medication record by Brand Name and some search by Generic name. By tokenizing the search terms it doesn’t matter which they they it always gives them the answer they need. Much more effective search and much more intuitive then a list of nebulous numbers. NICE FEATURE SKUID! Love it!