New Option for the Lookup Component
Thanks to vijayignatius, we have a new option for the Lookup component. He has provided a new attribute that lets you pick a field other than the Display field to be used as the the field to search on. Read on for his excellent overview of why and how you can use this new feature.
By default the search term entered by the user will be searched against the field configured in “I2_Display Which Field?”. While this should be sufficient for most of the use cases as “I6_Filter on which field?” and “Where Clause” will provide additional flexibility to make the query more selective, in some cases, you may want the flexibility for the user entered search term to be searched against a different field than the “I6_Filter on which field?” which is what the new “I8_Search this Field instead of Display Field” provides.
As an example, consider a scenario where you have 50M Accounts and some users have access to all 50M Accounts. You have the Account External ID( say master data management id) stored as “External_ID__c” in Salesforce and you need the “I2_Display Which Field?” to be a formula field which is a concatenated value of “Name + External_ID__c + BillingStreet” but want the search term to be searched against the “Name” field. In this case, you would configure the Lookup FSC component as below:
- “I2_Display Which Field?” → Name_ExtId_Address__c ( which is a formula field)
- “I8_Search this Field instead of Display Field” → Name
This will ensure that the user entered search term is searched against the “Name” field and not the “Name_ExtId_Address__c” field. The result of which will be displayed as follows:
In the above example, you can also configure “I8_Search this Field instead of Display Field” to search against “External_ID__c”, the result of which will be displayed as follows:
If you would like to provide a even more better user experience, you could use 2 UnofficialSF – LookUp component, one configured to search against the “Name” field and another against the “External_ID__c” and use a toggle to dynamically show/hide the relevant search component so that the user can either search by “Name” or “External_ID__c” as in the below screenshots.