Walkthrough: Configuring additional entities for global search  

Overview

You can enable additional entities for search functionality. Configuring search for additional entities requires additional actions, which are described in this article. These explicit configuration steps ensure that no records will accidentally be made available using global search.

Steps to configure search for additional entities

To configure search for additional entities:

  1. Enable additional entities search for the first time by adding a new setting Search/EnableAdditionalEntities and set it to true. This is a one-time step that enables search for all additional out-of-the-box and custom entities.

  2. Create Portal Search view for each additional entity with the required filters and columns that needs to be searchable.

  3. Configure entity permissions for each additional entity with a Web Role to have at least read privilege. Skip this step if you already have the read permissions configured for each entity.

  4. Create a record details page for each entity to show the details of the selected record from the search results page. Skip this step if you already have created separate results record details page for each entity.

  5. Create a site marker named <entitylogicalname>_SearchResultPage for each entity with the associated record details page.

  6. Rebuild the search index.

  7. Verify the search results.

Warning

If you don't create a record details page, or if you don't bind the record details page with site marker for search, you won't be able to select the additional entity records from search results page to view the record details.

Site setting for additional entities

The site setting Search/EnableAdditionalEntities is required when configuring additional entities for search.

Important

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.

Site marker for record details page

The record details page is configured using a Site Marker named <entitylogicalname>_SearchResultPage.

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 record details 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 record details page. For more information about adding forms on a page, go to Compose a page.

Important

Ensure that your record details page has an entity form, or has logic written to show the search result details. For example, Step 4 - Add record details page in the following walkthrough.

The following walkthrough explains each step in detail with a sample database and solution to configure search for additional entities.

Note

  • This 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

  1. Sign in to Power Apps.

  2. Ensure that you're in the appropriate environment where your portal exists.

  3. Select Apps in the left navigation pane, and locate the Portal Management model-driven app.  

    Portal Management

    Note

    The Portal Management app might be named Dynamics 365 Portals if you're in an environment where Dynamics 365 applications are installed.

  4. Select to open the Portal Management app, and then go to Site Settings in the left navigation pane.

  5. Create a new setting, Search/EnableAdditionalEntities, and set its value to true.

    Site setting for EnableAdditionalEntities

  6. Create or update the search/filters setting, and add the value Products:nwind_products.

    Search/filters site setting

Step 2: Create or verify the Portal Search view

Note

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.

  1. Go to Power Apps, and select Solutions from the left navigation pane.

  2. Select Northwind Traders.

    Select solution

  3. Search for the Order Product entity.

    Order Product entity

  4. Select the Order Product entity, and then select Views.

    Order Product - Views

  5. Ensure that you see Portal Search in the views list.

    Portal Search view

    If the Portal Search view doesn't already exist, select Add view, enter the name as Portal Search, and then select Create.

    Add a view

    Add the Portal Search view

  6. Ensure appropriate columns are added to the view for search.

    Add columns

  7. If you edited the view, be sure to select Save, and then Publish before you continue.

    Save and publish

Step 3: Create entity permissions

  1. Sign in to Power Apps.

  2. Select Apps in the left navigation pane, and then select to open the Portal Management model-driven app.  

  3. Select Entity Permissions in the left navigation pane.

  4. Select New.

    New Entity Permission record

  5. 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.

    Scope and Read permissions

  6. Select Save & Close.

  7. Select and open Northwind Products Read All.

  8. Scroll down to the Web Roles section, and then select Add Existing Web Role.

    Add an existing web role

  9. Search for Authenticated Users, and then select Add:

    Add authenticated users

Step 4: Add record details webpage

  1. Go to Power Apps, and select Apps in the left navigation pane.

  2. Select More Commands (…) for the portal, and then select Edit to open the portal in Power Apps Studio.

  3. Select New Page from the menu in the upper-left corner, and then select the Blank layout for the page.

    New page

  4. Enter the webpage name as Order Products.

    Note

    This page will be shown when users select a record from the search results page to view the details of the selected record.

  5. Select Components in the left navigation pane, and then add a Form component to this webpage.

    Add a form component

  6. 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.

    Set the mode

Step 5: Add a site marker for record details webpage

  1. Sign in to Power Apps.

  2. Select Apps in the left navigation pane, and select to open the Portal Management model-driven app.  

  3. Select Site Marker from the left navigation pane.

  4. Select New, and then create a new site marker by using the following details:

    • Name: nwind_products_SearchResultPage
    • Page: Order Products

    New site marker

Step 6: Rebuild the search index

  1. Browse your portal by using a user account that has the Administrator web role assigned.

  2. Append the URL in the address bar with /_services/about, and then select Enter.

    _services_about page

  3. Select Clear cache.

  4. After clearing the cache, select Rebuild search index.

Step 7: Verify that global search works with the custom entity

  1. Browse to the portal with a user that has Authenticated Web Role assigned.

  2. 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 get the results associated with the nwind_products entity.

    Search results

Next steps

Remove an entity from global search

See also

Search related site settings