Last week, the StarrForce Tips Blog covered changing Salesforce Global Search options and search terms: Salesforce Global Search Tips – Part 2, Our Salesforce Best Practice of the Week.
This week, we cover Global Search wildcards and operators, wildcard behaviors and limitations.
Salesforce Wildcards and Operators
You can use the * (asterisk) and ? (question mark) wildcards to refine results. Use * to match one or more characters, or ? to match a single character. For example, searching for bob jo* finds items with Bob Jones and Bob Johnson, and searching for jo?n finds items with john and joan. You can also use the AND, OR, AND NOT, ( ) (parentheses), and ” ” (quotation marks) operators to refine results.
* (asterisk):
Asterisks match one or more characters at the middle or end (not the beginning) of your search term. For example, a search for john* finds items that start with variations on the term john, such as, johnson or johnny. A search for mi* meyers finds items with mike meyers or michael meyers. You can use an * at the beginning of a search term in a standard lookup search.
?(question mark):
Question marks match only one character in the middle (not the beginning or end) of your search term. For example, a search for jo?n finds items with the term john or joan but not jon or johan. You can’t use a ? in a lookup search.
Salesforce Global Search Wildcard Behavior and Limitations
- Wildcards take on the type of the preceding character. For example, aa*a matches aaaa and aabcda, but not aa2a or aa.!//a, and p?n matches pin and pan, but not p1n or p!n. Likewise, 1?3 matches 123 and 143, but not 1a3 or 1b3.
- You can’t search for a ? or * in a search phrase that is enclosed in quotation marks or when Exact phrase is selected in the search scope because they function as wildcards. For example, “my wo?d” matches my wood and my word.
- You can’t use wildcards in the middle of Chinese, Japanese, Korean, or Thai search terms.
- When entering search terms in Salesforce Global Search, the search box drop-down list gives you the option to search for your term with an * added to the end. For example, type jo in the search box, then select Search for jo* (starts with) to find joan, john, johnson, and other matches that start with jo.
Salesforce Operators
AND:
Finds items that match all of the search terms. For example, acme AND california finds items with the word acme and the word california, but not items with only the word acme.
Using AND is optional in most cases, because searching for acme california is the same as searching for acme AND california. However, when searching articles, documents, files, and solutions on their respective tabs, AND must be used because OR is the default operator for these objects on their tabs.
OR:
Finds items with at least one of the search terms. For example, acme OR california finds items with either acme or california or both.
AND NOT:
Finds items that don’t contain the search term. For example, acme AND NOT california finds items that have the word acme but not the word california.
( ) (parentheses):
Group search terms together. Grouped search terms are evaluated before other search terms in your string.
” ” (quotation marks):
Find an exact phrase. This is the same as selecting Exact phrase in Global Search. For example, a search for “monday meeting” finds items that contain monday meeting, but not items that contain monday afternoon meeting or monday’s meeting.
In the next Salesforce Global Search Tips blog: we cover Search Order and Search Tips.