Walkthrough: Configuring additional entities for global search
You can enable additional entities for search functionality. Configuring search for additional entities requires additional actions, which are described in this article.
Following considerations apply when configuring additional entities for global search:
- Ensure that the site setting for search for additional entities is enabled.
- Create a view named Portal Search for any additional entity you want to enable search for. More information: searchable fields in global search
- Ensure an Entity Permission is created that provides Read privilege, and appropriate scope for the records to show in search results.
- Associate the entity permission with required Web Roles.
- Entity permissions must be associated with the Anonymous Web Role if you want to allow anonymous search for an entity.
- Configure a search results page to display search results.
The explicit configuration explained above ensures that no records will accidentally be made available via global search.
Site setting for additional entities
The site setting Search/EnableAdditionalEntities is required when configuring additional entities for search.
Search/EnableAdditionalEntities is explicitly for enabling search for additional entities. The main search site setting Search/Enabled must be set to true when using search functionality.
You can also configure other related site settings similar to the search configuration for default entities. For example, you can use the Search/Filters setting to configure additional entities and add a drop-down filter option to the global search. More information: Site setting
Results page for additional entities
The search result page is configured via a Site Marker named
For example, if your entity logical name is nwind_products, the site marker will be
nwind_products_SearchResultPage. The value of the site marker is the page that you want to open when that search result is selected. By default, a record ID is passed in the id querystring parameter to the search results page.
Ensure that your search results page has an entity form, or has logic written to show the search result details.
Walkthrough - configure search for additional entities with sample database
The following walkthrough explains how to enable search for the Order Products entity in the sample database Northwind, available with Common Data Service.
For more information about sample databases, see Install Northwind Traders database and apps.
You can follow the walkthrough with an entity of your choice by replacing the nwind_products entity name with your entity's logical name.
Step 1: Add or update search site settings
Sign in to Power Apps.
Ensure that you're in the appropriate environment where your portal exists.
Select Apps in the left navigation pane, and locate the Portal Management model-driven app.
The Portal Management app might be named Dynamics 365 Portals if you're in an environment where Dynamics 365 applications are installed.
Select to open the Portal Management app, and then go to Site Settings in the left navigation pane.
Create a new setting, Search/EnableAdditionalEntities, and set its value to true.
Create or update the search/filters setting, and add the value Products:nwind_products.
Step 2: Create or verify the Portal Search view
The following steps require the Northwind Traders solution to be installed. If you want to use another entity, use the appropriate solution or use the Default solution.
Go to Power Apps, and select Solutions from the left navigation pane.
Select Northwind Traders.
Search for the Order Product entity.
Select the Order Product entity, and then select Views.
Ensure that you see Portal Search in the views list.
If the Portal Search view doesn't already exist, select Add view, enter the name as Portal Search, and then select Create.
Ensure appropriate columns are added to the view for search.
If you edited the view, be sure to select Save, and then Publish before you continue.
Step 3: Create entity permissions
Sign in to Power Apps.
Select Apps in the left navigation pane, and then select to open the Portal Management model-driven app.
Select Entity Permissions in the left navigation pane.
Enter the name as Northwind Products Read All, and then select the appropriate Scope and the Read privilege.
For this example, the Global scope is provided to the nwind_products entity.
Select Save & Close.
Select and open Northwind Products Read All.
Scroll down to the Web Roles section, and then select Add Existing Web Role.
Search for Authenticated Users, and then select Add:
Step 4: Add a webpage
Go to Power Apps, and select Apps in the left navigation pane.
Select More Commands (…) for the portal, and then select Edit to open the portal in Power Apps Studio.
Select New Page from the menu in the upper-left corner, and then select the Blank layout for the page.
Enter the webpage name as Order Products. This page will be configured as the search results page.
Select Components in the left navigation pane, and then add a Form component to this webpage.
Select the Use existing option on the right side of your workspace, choose the View Products form for the nwind_products entity, and then set Mode to ReadOnly.
Step 5: Add a site marker for the search results details page
Sign in to Power Apps.
Select Apps in the left navigation pane, and select to open the Portal Management model-driven app.
Select Site Marker from the left navigation pane.
Select New, and then create a new site marker by using the following details:
- Name: nwind_products_SearchResultPage
- Page: Order Products
Step 6: Rebuild the search index
Browse your portal by using a user account that has the Administrator web role assigned.
Append the URL in the address bar with /_services/about, and then select Enter.
Select Clear cache.
After clearing the cache, select Rebuild search index.
Step 7: Verify that global search works with the custom entity
Browse to the portal with a user that has Authenticated Web Role assigned.
Go to the search toolbar or the search page, and search for a known record.
For example, use the search keyword Northwind Clam Chowder to display results associated with the nwind_products entity.