Click here to Skip to main content
15,796,456 members
Articles / AL
Tip/Trick

Designing an extension in Dynamics 365 Business Central using AL language plugin within Visual Studio Code

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
6 Dec 2023CPOL2 min read 569   2  
Schema Design Viewer Utility extension within Dynamics 365 Business Central is designed to provide basic table design & structure information, which also lets users to browse the data from the desired tables in runtime.
Schema Design Viewer Utility within Dynamics 365 Business Central is designed to provide basic table design & structure information, which also lets users to browse the data from the desired tables at the runtime. This V2 Extensions using AL language in Visual Studio Code is designed within Microsoft Dynamics 365 Business Central.

Introduction

Schema Design Viewer utility within Dynamics 365 Business Central is designed to provide basic table design & structure information, which also lets users to browse the data from the desired tables at the runtime. 

Background

V2 Extensions using AL language in Visual Studio Code is designed within Microsoft Dynamics 365 Business Central. This is article is intended to target audience who are are intermediate and advanced users familiar with AL and Dynamics 365 Business Central ERP.

This extension was designed to cross check the schemas and data from the objects at the runtime without leaning on the development tools/environment. As this provides a quick reference and access to all objects( including Custom + Out of the box Schemas) in Dynamics 365 Business Central ERP. 

Using the code

Here's a quick tour in designing V2 Extensions using AL language in Visual Studio Code with Microsoft Dynamics 365 Business Central. This extension assists in viewing the schema structure and lets the user browse the data in a separate tabs in browser.

Following Extension is dependent on Microsoft System Application and Microsoft Base Application out of the box extensions, used are v17.1 base app references for development and tested it in version BC 18.3. 

Deploy the attached extension app file from zip using the following command from the Administration Business Central Development Shell

Download Chaitanya_Kanumukula_Schema_Design_Viewer_1.0.0.0.zip

Image 1

Publish-NAVApp -ServerInstance BC180 -Path ".\Chaitanya Kanumukula_Schema Design Viewer_1.0.0.0.app" -SkipVerification 

Development IDE 

Demonstration used is for reference to show the reference packages, This compiled app supports BC version starting from v17.1 onwards to the latest.

Image 2

C#
/// <summary>
/// Page Schema Design Viewer And Browser (ID 50140).
/// Utility designed for unblocking users from accessing the basic table design information and browse data of the table object.
/// Need this extension specially at the runtime.
/// </summary>
///
page 50140 "Schema Design Viewer"
{
    PageType = list;
    ApplicationArea = All;
    UsageCategory = Lists;
    SourceTable = Field;

   /// <summary>
    /// Field is a SYSTEM table of 2000000041
   /// BC out of the box doens't allow the delete, Modify, Insert options on Table design and Structures.
    /// </summary>
    DeleteAllowed = false;
    InsertAllowed = false;

   layout
    {
        area(Content)
        {
            group(General)
            {
                field("Table ID"; "Table ID")
                {
                    ApplicationArea = All;
                    ToolTip = 'Table ID';
                    Caption = 'Table ID';
                    Lookup = true;
                    TableRelation = "Table Metadata".ID;

                    // After selection when the focus of the control moves to next
                    // Change the Object link.
                    trigger OnValidate()
                    begin
                        ObjectURLLink := DrillDownURLTxt + FORMAT("Table ID");
                    end;
                }

                field("ObjectURL"; "ObjectURLLink")
                {
                    ApplicationArea = All;
                    Editable = true;
                    ToolTip = 'Browse Object URL';
                    Caption = 'Browse Object URL';

                    // Create the link to the database schema object, so it can be opened in a separate tabs in browser.
                    // This will be a handy, if it can be opened in separate tabs.
                    trigger OnDrillDown()              
                    begin

                        ObjectURLLink := DrillDownURLTxt + FORMAT("Table ID");
                        Hyperlink(DrillDownURLTxt + FORMAT("Table ID"));
                    end;
                }
            }
            repeater(GroupName)
            {
                field(TableNo; rec.TableNo)
                {
                    ApplicationArea = All;
                    Editable = false;
                    ToolTip = 'TableNo';
                    Caption = 'TableNo';
                }
                field("No."; rec."No.")
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'No';
                    Caption = 'No';
                }
                field(TableName; rec.TableName)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'TableName';
                    Caption = 'TableName';
                }
                field(FieldName; rec.FieldName)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'FieldName';
                    Caption = 'FieldName';
                }
                field("Type Name"; rec."Type Name")
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'Type Name';
                    Caption = 'Type Name';
                }
                field(Len; rec.Len)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'Len';
                    Caption = 'Len';
                }
                field(OptionString; rec.OptionString)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'OptionString';
                    Caption = 'OptionString';
                }
                field(RelationTableNo; rec.RelationTableNo)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'RelationTableNo';
                    Caption = 'RelationTableNo';
                }
                field(RelationFieldNo; rec.RelationFieldNo)
                {
                    ApplicationArea = all;
                    Editable = false;
                    ToolTip = 'RelationFieldNo';
                    Caption = 'RelationFieldNo';
                }
            }
        }
        area(Factboxes)
        {
        }
    }
    actions
    {
        area(Processing)
        {
            action(ActionName)
            {
                ApplicationArea = All;
                Caption = 'Show Table Details';
                ToolTip = 'Show Table Details';
                Image = ShowSelected;
                Promoted = true;
                PromotedOnly = true;
                PromotedCategory = Process;

                trigger OnAction();
                begin
                    rec.SetRange(TableNo, "Table ID");
                end;
            }

            action(ActionName1)
            {
                ApplicationArea = All;
                Caption = 'Browse Data';
                ToolTip = 'Browse Data';
                Image = ShowSelected;
                Promoted = true;
                PromotedOnly = true;
                PromotedCategory = Process;
                trigger OnAction();
                begin
                    rec.SetRange(TableNo, "Table ID");
                    Hyperlink(DrillDownURLTxt + FORMAT("Table ID"));
                end;
            }

       }
    }
    trigger OnOpenPage()
    var
    begin
        DrillDownURLTxt := GetUrl(ClientType::Web) + '/?table=';
    end;

    // Prompt message on modification                  
    trigger OnModifyRecord(): Boolean
    begin
        Error('Modification is not allowed on the schema structures.');
    end;
    var
        "Table ID": Integer;
        DrillDownURLTxt: Text;
        ObjectURLLink: Text;
}

Using the extension

Install the extension

Image 3

Search the extension by its name and start using the functionality.Image 4

Points of Interest

Used this tool practically while in the data migration process. It assisted as a quick reference tool accessing the schema info and data during the runtime. I further wanted to add few more functionalities but may enhance this later at some point in time with future releases.

History

Initial release 12/5/2023

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
United States United States
Mr. Kanumukula is a IT-Professional and has been in the industry since 1997.
• Around 15+ years of experience in the areas of system design & architecture, application programming, development, testing, deployments, execution with implementations & Roll-outs of business applications in cloud/on-premise.
• Experience with Dynamics 365 for F&O/Dynamics AX, D365 for Business Central/NAV,(Inc -Visual Studio.Net, X++, AL, C#, CSide, SharePoint, SQLServer, SFDC, Power-BI, Power Apps, Dataverse/Common Data Service, CRM, SSIS/SSRS/SSAS, BizTalk, IOT, IIOT, JAVA, AWS, GCP, Azure, API, etc)
• Experience in managing Operations & Data Center maintenance both on-premise & cloud hosting, infrastructure/applications assessments & build systems.
• Experience in ERP upgrades, Mulesoft API's,MS Dynamics 365,Azure administration & hosting, LCS-Life Cycle Services.
• Experience with Commitment to Quality, technical quality assurance(before, during & after development). Create partnership with project manager to give technical assistance regarding important decisions.
• Well-Versed with Agile, SCRUM & CMMI process & methodologies to support rapid iterative Quality software development.

A highly motivated, self-starter & problem solver with multi-tasking skills, Had managed and served through an established process to get the job done in a timely and efficient manner with an eye on every detail during ERP-implementations. Flexible to work under stress and have ability to prioritize workload and stay organized in a fast-paced environment.

Learned & adapted to new technologies & tools at ease, aggressively delivered tasks on-demand at a fast-pace satisfying the needs of product owners, product development, program managers, Vendors, Higher Management, Internal/External Clients.

Have a proactive & positive attitude with a willingness to do what it takes to complete the job. Self-managed work style within a team environment. Extremely detail & Customer service oriented.

Comments and Discussions

 
-- There are no messages in this forum --