Add the Global Search Box to Your Customized Experience Cloud Site HTML Header
If you customize your Experience Coud sites with an HTML header, you hide the global search box. To take advantage of this search functionality, add a form to your custom header.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
You can add the global search box to both Experience Builder and Salesforce Tabs + Visualforce sites.
-
In your customized HTML header, embed a form similar to this one.
<form action="/<site name>/search/SmartSearch" method="get"> <input id="phSearchInput" type="text" name="str"/> <input type="submit" value="Search"/> </form> -
Replace <site name> with the unique value you used for the URL
when creating the Experience Cloud site.
For example, if you entered customers as the unique value for your site URL, the form would look like this example:
<form action="/customers/search/SmartSearch" method="get"> <input id="phSearchInput" type="text" name="str"/> <input type="submit" value="Search"/> </form>
With global search from your internal org, you can get uneven results when searching for an Experience Cloud site User record. Here’s why and what you can do about it. Each site has a unique network ID. When you create a user through Contact record | Create External User, the new User record is assigned to a site's network ID.
Global search looks for records in the internal org, which has a different network ID than the site. A global search doesn't search inside sites. Since the User record is associated with a site network ID, global search doesn't return results for that record.
The workaround is to create User records in the internal org, and then associate the records to a site. You can associate an internal User record to a site by linking the internal record to a Contact record. After you forge the link, you can find the User record through global search. The User record's network ID is now associated with the internal org.