Why does Contact, Lead, or User lookup search results not include records that have spaces in the First Name or Last Name field?
|Knowledge Article Number||000123565|
|Description||Why do I not get the results I expect when I search for contacts, leads, or users with middle names via lookup search?|
|Resolution||When using a lookup field or merging records for a Contact, Lead, User, or other Individual with a space in either the first or last name you will need to put quotes around the part of the name with spaces. If there are no quotes around either the first or last name (depending on which one has the space in it), the desired result may not be returned.
For example, a user is trying to lookup the Contact with the first name Joe Bob and the last name Smith to associate to a Case record. When populating the Contact lookup field, you would either have to search for "Joe Bob" or Smith in order to find this Contact. If Joe Bob Smith is typed in the lookup without quotes, the desired record may not be returned. Other records that match part of the name with the space in it may be returned, however.
Why does lookup search behave this way?
Search stores each string for matching and uses spaces to separate those strings. If you do not indicate that you want to find two strings in sequence, separated by a space in your search by using quote marks, search will match those strings no matter what order they appear in.
Can we do anything to change this / workaround it?
Using quotes is called phrase search and that is the workaround. For example, To search for a user whose first name contains a space, add a comma before the first name. For example, to search for Joe Bob Smith, enter "Joe Bob" or Smith,"Joe Bob"