Lookup Searches Functionality

  • 1
  • Question
  • Updated 5 years ago
  • Answered
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?
Photo of Rich Slack

Rich Slack

  • 4,134 Points 4k badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
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: