Hi, Readers.
Today I would like to discuss how to quickly run a table in Business Central.
Preface
For developers, administrators, and support personnel, it can be useful to inspect table data in the tenant database, particularly when debugging or troubleshooting. To support this need, you can view table objects in the Web client.
To view a table, you add the table=<TableID>
parameter to the client’s address (URL), replacing <TableID>
with the ID of the table that you want to view.
For example, to view table 18 Customer in your current company.
https://businesscentral.dynamics.com/d8f36038-1f93-4543-affc-5dc92b6ee871/Sandbox18?table=18
For more details: Viewing Table Data
So as long as you know the table number, you can run the table directly from the client. But if I am not a developer, where can I find all the table numbers and names?
As you might know, on the Report Layout Selection page, you can search all reports in Business Central and run the selected report. Is it possible to do the same for all tables?
In this post, I will share two ways, one is the standard feature starting from BC16, and the other is the customization feature. Hope this will help.
PS: You can find all tables in Configuration Package and export records. But you can’t open them directly on the client.
Standard feature (Table Information)
The page 8700 Table Information provides information about all system and business tables in a Business Central solution. In particular, the page displays information about the amount of data the tables contain.
This information is useful for troubleshooting performance problems, because let’s you see the distribution of data size across tables.
To open this page, select the search icon, enter Table Information, and then choose the related link.
You can also open the Table Information page from Dynamics 365 Business Central admin center. Choose Capacity -> List of tables.
Table Information page:
Column | Description |
---|---|
Company Name | The name of the company, if any, that the table belongs to. |
Table Name | The name of the table. |
Table No. | The ID of the table |
No. of Records | The total number of records stored in the table. |
Record Size | The average record size in KB/record. The value is calculated using the following formula: 1024(Size)/(No. of Records)`. |
The point is that you can click No. of Records field to open the record.
I’m sure you already know that we can search for the table on this page and open it directly.
Test Video:
Customization
You can also made an extension to do this.
For the SourceTable, we are going to use Table 2000000058 AllObjWithCaption.
Next, because Table Object does not have Run functions like Page Object, Report Object, or Xmlport Object. So we have to use System.Hyperlink Method.
System.Hyperlink Method: Passes a URL as an argument to an Internet browser, such as Windows Internet Explorer.
Let’s start.
Source Code:
page 83100 "ZY Show Table List"
{
Caption = 'Show Table List';
Editable = false;
PageType = List;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = AllObjWithCaption;
SourceTableView = where("Object Type" = filter(= Table));
layout
{
area(Content)
{
repeater(TableList)
{
field("Object Type"; Rec."Object Type")
{
ApplicationArea = All;
}
field("Object ID"; Rec."Object ID")
{
ApplicationArea = All;
}
field("Object Name"; Rec."Object Name")
{
ApplicationArea = All;
}
field("Object Caption"; Rec."Object Caption")
{
ApplicationArea = All;
}
field("Object Subtype"; Rec."Object Subtype")
{
ApplicationArea = All;
}
field("App Name"; GetAppName(Rec."App Package ID"))
{
ApplicationArea = All;
}
}
}
}
actions
{
area(Processing)
{
action("Run Selected Table")
{
Caption = 'Run Selected Table';
ApplicationArea = All;
Image = ExecuteBatch;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Process;
Scope = Repeater;
trigger OnAction()
begin
Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Table, Rec."Object ID"));
end;
}
}
}
local procedure GetAppName(var AppPackageID: Guid): Text[250]
var
NavInstalledApp: Record "NAV App Installed App";
begin
NavInstalledApp.Reset();
NavInstalledApp.SetRange("Package ID", AppPackageID);
if NavInstalledApp.FindFirst() then
exit(NavInstalledApp.Name);
end;
}
PS: You cannot view virtual tables or the following system tables (2021/03/31):
ID | Name |
---|---|
2000000170 | Configuration Package File |
2000000173 | Data Sensitivity |
2000000100 | Debugger Breakpoint |
2000000103 | Debugger Watch |
2000000130 | Device |
2000000114 | Document Service |
2000000190 | Entitlement Set |
2000000191 | Entitlement |
2000000180 | MediaSet |
2000000181 | Media |
2000000195 | Membership Entitlement |
2000000162 | Nav App Capabilities |
2000000152 | Nav App Data Archive |
2000000161 | Application Dependency ( *Nav App Dependencies) |
2000000150 | Application Object Metadata ( *Nav App Object Metadata) |
2000000163 | Nav App Object Prerequisites |
2000000142 | Application Resource ( *Nav App Resource) |
2000000151 | Installed Application ( *Nav App TenantApp) |
2000000160 | Published Application ( *Nav App) |
2000000071 | Object Metadata |
2000000079 | Object Tracking |
2000000001 | Object |
2000000198 | Page Documentation |
2000000186 | Profile Page Metadata |
2000000082 | Report Layout |
2000000065 | Send To Program |
2000000112 | Server Instance |
2000000066 | Style Sheet |
2000000197 | Token Cache |
2000000081 | Upgrade Blob Storage |
2000000121 | User Property |
2000000076 | Web Service |
2000000194 | Webhook Notification |
2000000199 | Webhook Subscription |
Updated: Run Object Tool (Table, Page, Query, Report, XMLport)
END
Hope this will help.
Thanks for reading.
ZHU
コメント