Dynamics 365 Business Central: How to get the full version text in Help & Support via AL (Record daily version information)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about an interesting topic, how to get the full version text in Help & Support via AL.
From the Help pane, you can access the Help & Support page inside Business Central that includes helpful links.

On the Troubleshooting section, you can find the most complete version information for the current environment. For example,
Version: W1 24.2 (Platform 24.0.21458.0 + Application 24.2.20227.20460)

Version: US Business Central 24.2 (Platform 24.0.21364.0 + Application 24.2.20227.20460)

The numbers are updated based on Microsoft’s builds. In the default version of Business Central online, platform and application have the same major version number but different build numbers.
The following list describes the meaning of each of the numbers in a full version number:

  • major is the major version of Business Central
    • 24 is the Business Central 2024 release wave 1 update in April 2024 and forward
    • 23 is the Business Central 2023 release wave 2 update in October 2023 and forward
    • 22 is the Business Central 2023 release wave 1 update in April 2023 and forward
    • 21 is the Business Central 2022 release wave 2 update in October 2022 and forward
    • 20 is the Business Central 2022 release wave 1 update in April 2022 and forward
    • 19 is the Business Central 2021 release wave 2 update in October 2021 and forward
    • 18 is the Business Central 2021 release wave 1 update in April 2021 and forward
    • 17 is the Business Central 2020 release wave 2 update in October 2020 and forward
    • 16 is the Business Central 2020 release wave 1 update in April 2020 and forward
    • 15 is the Business Central 2019 release wave 2 update in October 2019 and forward
    • 14 is the Business Central April 2019 release
    • 13 is the Business Central October 2018 release
    • 12 is the April 2018 launch of Business Central
  • minor is the monthly update number, such as 0, 1, or 5.
  • build is the five digit build number, such as 23456.
  • revision is set to 0 for the original release and can remain at 0. However, if the tenant is patched with a hotfix, then that build number can be applied.

In other words, if you see a version number such as 20.1.23456.26323, then it means major version 20, update number 1, build number 23456, and hotfix number 26323. More details: Version numbers in Business Central

The first question is, can this information be obtained in AL? (Help & Support page is a system page. We don’t have access to its standard code)

Yes, this time we can use codeunit 9015 “Application System Constants”. Let’s look at a simple example.

Test code:

pageextension 50201 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage()
    var
        AppSysConstants: Codeunit "Application System Constants";
        VersionInfo: Label 'Version info:\\Application Version is ''%1''.\\The Build File Version is ''%2''.\\The Application Build is ''%3''.\\The Build Branch is ''%4''.\\The Platform Production Version is ''%5''.\\The Platform File Version is ''%6''.';
    begin
        Message(VersionInfo, AppSysConstants.ApplicationVersion(), AppSysConstants.BuildFileVersion(), AppSysConstants.ApplicationBuild(),
        AppSysConstants.BuildBranch(), AppSysConstants.PlatformProductVersion(), AppSysConstants.PlatformFileVersion());
    end;
}

So we can use the following three functions.

1. procedure ApplicationVersion()

2. procedure PlatformFileVersion()

3. procedure BuildFileVersion() – The version number here may be greater than that shown on the Help & Support page, so it can be understood that this is the latest one.

Let’s look at another example.

Great.

Test code:

pageextension 50201 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage()
    var
        ApplicationSystemConstants: Codeunit "Application System Constants";
        Msg: Label 'Version: %1 (Platform %2 + Application %3)';
    begin
        Message(Msg, ApplicationSystemConstants.ApplicationVersion(), ApplicationSystemConstants.PlatformFileVersion(), ApplicationSystemConstants.BuildFileVersion());
    end;
}

Okay, so when can this be used? As you know, partners or customers have the authority to set the update date and update time for Major and Minor Updates. But build update and revision update are pushed by Microsoft, and we don’t know when the environment is updated (Bug fix or Security Updates). Using this method, you can record the version number regularly, such as every day, or every half a day. We can create a table to save the data, a codeunit to record the data, and then set it in the Job Queue. Here is a simple example.

Table:

Page:

Codeunit:

Then I set it up in the Job Queue and ran it twice.

There was a version change yesterday.

Great. Give it a try!!!😁

Source code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)

codeunit 50200 "Record version history"
{
    trigger OnRun()
    var
        ZYVersionHistory: Record "ZY Version History";
        LastUsedEntryNo: Integer;
        ApplicationSystemConstants: Codeunit "Application System Constants";
        Msg: Label '%1 (Platform %2 + Application %3)';
        LastVersion: Text[100];
    begin
        LastUsedEntryNo := 0;
        LastVersion := '';
        ZYVersionHistory.Reset();
        ZYVersionHistory.SetCurrentKey("Entry No.");
        ZYVersionHistory.Ascending(true);
        if ZYVersionHistory.FindLast() then begin
            LastUsedEntryNo := ZYVersionHistory."Entry No.";
            LastVersion := ZYVersionHistory.Version;
            ZYVersionHistory.Init();
            ZYVersionHistory."Entry No." := LastUsedEntryNo + 1;
            ZYVersionHistory.Version := StrSubstNo(Msg, ApplicationSystemConstants.ApplicationVersion(), ApplicationSystemConstants.PlatformFileVersion(), ApplicationSystemConstants.BuildFileVersion());
            ZYVersionHistory.Date := Today;
            if ZYVersionHistory.Version = LastVersion then
                ZYVersionHistory.Updated := false
            else
                ZYVersionHistory.Updated := true;
            ZYVersionHistory.Insert();
        end else begin
            ZYVersionHistory.Init();
            ZYVersionHistory."Entry No." := 1;
            ZYVersionHistory.Version := StrSubstNo(Msg, ApplicationSystemConstants.ApplicationVersion(), ApplicationSystemConstants.PlatformFileVersion(), ApplicationSystemConstants.BuildFileVersion());
            ZYVersionHistory.Date := Today;
            ZYVersionHistory.Updated := false;
            ZYVersionHistory.Insert();
        end;

    end;
}

table 50200 "ZY Version History"
{
    DataClassification = CustomerContent;
    Caption = 'ZY Version History';

    fields
    {
        field(1; "Entry No."; Integer)
        {
            Caption = 'Entry No.';
        }
        field(2; Version; Text[100])
        {
            Caption = 'Version';
        }
        field(3; Date; Date)
        {
            Caption = 'Date';
        }
        field(4; Updated; Boolean)
        {
            Caption = 'Updated';
        }
    }

    keys
    {
        key(PK; "Entry No.")
        {
            Clustered = true;
        }
    }
}

page 50200 "ZY Version History"
{
    Caption = 'ZY Version History';
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = "ZY Version History";
    Editable = false;
    InsertAllowed = false;
    DeleteAllowed = false;
    ModifyAllowed = false;

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field("Entry No."; Rec."Entry No.")
                {
                    ApplicationArea = All;
                }
                field(Version; Rec.Version)
                {
                    ApplicationArea = All;
                }
                field(Date; Rec.Date)
                {
                    ApplicationArea = All;
                }
                field(Updated; Rec.Updated)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL