How to export all fields in all tables in Dynamics 365 Business Central

Dynamics 365 Business Central

Hello Everyone.
Today I want to share a method to export all fields in all tables in Dynamics 365 Business Central. You can use this method to export table number, field number, table name, field name, type, caption, ObsoleteState and so on in all tables in Business Central.
This method mainly uses a system table (table=2000000041).
Let’s first open the table directly and take a look.
Add “?table=2000000041” after the environment name.

The “Field” table will be opened.

Then let us check the structure of this table.
Although not all properties, this is sufficient.
So the next question is how to export the data in this table.

You may try to directly select all the lines in this table, and then directly copy them by “Ctrl + C“ and “Ctrl + V”.

But unfortunately, because of the characteristics of Business Central Web client, select all is not really select all. Only the rows displayed are selected.

So you must already know that the easiest way is to create a new list page to display all the fields of this table.
Let‘s try it.
New list page:
Called “Fields List”

Publish it and confirm.
Search for the “Fields List” and open the page.

Fields list:

Click action “Page -> Open in Excel”

The all fields will be downloaded.

Please note that this download is only all the standard fields of Business Central, if you need to download the fields in other PTE or Appsource Extensions, you need to add a dependencies of extensions in the app.json file. Then open fields list again, they can also be downloaded.

In addition, regarding the caption language, the fields list page will be displayed in the current language.

Therefore, if you want to export records in other languages, you first need to install the language pack , then switch the language, and export it with the above method.

I hope this will help. Thanks.
Source code:

page 83001 "Fields List"
{

    ApplicationArea = All;
    Caption = 'Fields List';
    PageType = List;
    SourceTable = Field;
    Editable = false;
    UsageCategory = Lists;

    layout
    {
        area(content)
        {
            repeater(FieldsList)
            {
                field(TableNo; TableNo)
                {
                    ApplicationArea = All;
                }
                field("No."; "No.")
                {
                    ApplicationArea = All;
                }
                field(TableName; TableName)
                {
                    ApplicationArea = All;
                }
                field(FieldName; FieldName)
                {
                    ApplicationArea = All;
                }
                field(Type; Type)
                {
                    ApplicationArea = All;
                }
                field(Len; Len)
                {
                    ApplicationArea = All;
                }
                field(Class; Class)
                {
                    ApplicationArea = All;
                }
                field(Enabled; Enabled)
                {
                    ApplicationArea = All;
                }
                field("Type Name"; "Type Name")
                {
                    ApplicationArea = All;
                }
                field("Field Caption"; "Field Caption")
                {
                    ApplicationArea = All;
                }
                field(RelationTableNo; RelationTableNo)
                {
                    ApplicationArea = All;
                }
                field(RelationFieldNo; RelationFieldNo)
                {
                    ApplicationArea = All;
                }
                field(SQLDataType; SQLDataType)
                {
                    ApplicationArea = All;
                }
                field(OptionString; OptionString)
                {
                    ApplicationArea = All;
                }
                field(ObsoleteState; ObsoleteState)
                {
                    ApplicationArea = All;
                }
                field(ObsoleteReason; ObsoleteReason)
                {
                    ApplicationArea = All;
                }
                field(DataClassification; DataClassification)
                {
                    ApplicationArea = All;
                }
                field(IsPartOfPrimaryKey; IsPartOfPrimaryKey)
                {
                    ApplicationArea = All;
                }
            }
        }
    }

}

END.

コメント

タイトルとURLをコピーしました