Dynamics 365 Business Central: Enabling Custom and Default Tables in the "Search Company Data" Feature

 Hi Colleagues,

Today, we will discuss how we can search custom table data using the "Search Company Data" feature in Business Central.

For more information regarding the "Search Company Data" feature, you can refer to the official Microsoft documentation: Search Company Data

I have added a test customer to the default customer table. 

and created three test entries in the Test Header custom table.

To search for data, enter one or more keywords in the "Tell Me" search box. Alternatively, when you run "Tell Me" in the context of an editable page, it will automatically search for the value in the currently selected field.

Click on "Search Company Data".


Here, you can see that the search results include the top results from the tables you have access to. However, custom table data is not showing in the list.

Reason: Test Header is not enabled in the list.

Now, follow below steps to add default or custom table data to the search list:

Click on the "Set up where to search" action.


The "Enable Lists for Searching" page will open. Here, you can see all the lists that are enabled for searching.


Disable "Show Only search enabled lists" to lists the all available options.


By default, only the tables relevant to specific roles are selected. However, you can browse other tables as well. You can select the tables you want to search in.

Select the table you want to add and enable the 'Enable Search' toggle.


Click on the name of the selected table. The 'Enable Fields for Searching' list page opens. You can customize the search to include fields in the selected table by turning on the 'Enable Search' toggle. By default, only indexed code and text-type fields, as well as fields used to identify the search result record, are enabled.


Refresh Business Central and search for the keyword. The list will be visible with the default tables data that we have added.

Code of the custom table and page I created for testing:

Table: 

table 50710 "Test Header"
{
    Caption = 'Test Header';
    DataClassification = CustomerContent;
    LookupPageId = "Test headers";

    fields
    {
        field(1; No; Integer)
        {
            Caption = 'No';
        }
        field(2; Name; Code[20])
        {
            Caption = 'Name';
        }
        field(3; "Type"; Code[10])
        {
            Caption = 'Type';
        }
    }
    keys
    {
        key(PK; No)
        {
            Clustered = true;
        }
    }
}

Card Page:

page 50722 "Test header"
{
    ApplicationArea = All;
    Caption = 'Test header';
    PageType = Card;
    SourceTable = "Test Header";
    layout
    {
        area(Content)
        {
            group(General)
            {
                Caption = 'General';
                field(No; Rec.No)
                {
                }
                field(Name; Rec.Name)
                {
                   
                }
                field("Type"; Rec."Type")
                {
                    
                }
            }
        }
    }
}

List Page: 

page 50704 "Test headers"
{
    ApplicationArea = All;
    Caption = 'Test headers';
    PageType = List;
    CardPageId = "Test header";
    SourceTable = "Test Header";
    UsageCategory = Lists;
    Editable = false;

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field(No; Rec.No)
                {
                }
                field(Name; Rec.Name)
                {
                }
                field("Type"; Rec."Type")
                {
                }
            }
        }
    }
}

Note: For a table to be searchable through the "Search in company data" feature, it must have the LookupPageId property set.

Hope this Helps!☺️


Regards,

Khushbu Rajvi

Comments