Dynamics 365 Business Central: How to add new video links to the Product Videos page

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about how to add new video links to the Product Videos page.

Some people prefer to watch content rather than read it. To that end, Microsoft is producing short, easily digestible videos that either stand alone, or supplement the user assistance.

In Business Central, you can get to the video library from some role centers, such as Accountant Role Center by choosing the Product Videos tile.

Or, choose the Tell me icon, enter Product Videos, and then choose the related link.

Default Video Library for Business Central:

First of all this page is not editable, and the source table of this page is temporary.

The Extensible property of page 1470 “Product Videos” is false.

The Access property of table 1470 “Product Video Buffer” is Internal.

So it seems impossible to add our new video links. Please don’t give up, this time we can use Video (Codeunit 3710).

For example:

Source code:

codeunit 80101 ProductVideosHandler
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::Video, 'OnRegisterVideo', '', false, false)]
    local procedure OnRegisterVideo(var Sender: Codeunit Video);
    begin
        Sender.Register('{e3aa89b8-e3bc-4898-befc-84b81bd37402}', 'New Product Video', 'https://www.youtube.com/embed/dbJAq4_fp7g', Enum::"Video Category"::Warehouse);
    end;
}

My new video link has been add to the Product Videos page.

PS: You can use personalization to display App ID and Category on the page.

If you need more flexible design, you can add a new manage page for video links.

New table:

New table logic:

New Page:

Codeunit:

Test Video:

Source Code: GitHub

codeunit 80101 ProductVideosHandler
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::Video, 'OnRegisterVideo', '', false, false)]
    local procedure OnRegisterVideo(var Sender: Codeunit Video);
    var
        NewProductVideoLinks: Record NewProductVideoLink;
    begin
        NewProductVideoLinks.Reset();
        if NewProductVideoLinks.FindSet() then
            repeat
                Sender.Register(NewProductVideoLinks."App ID", NewProductVideoLinks.Title, NewProductVideoLinks."Video Url", NewProductVideoLinks.Category);
            until NewProductVideoLinks.Next() = 0;
    end;
}

table 80101 NewProductVideoLink
{
    Caption = 'New Product Video Links';
    DataClassification = CustomerContent;

    fields
    {
        field(1; EntriesNo; Integer)
        {
            Caption = 'Entries No.';
            DataClassification = CustomerContent;
        }
        field(2; Title; Text[250])
        {
            Caption = 'Title';
            DataClassification = SystemMetadata;
        }
        field(3; "Video Url"; Text[2048])
        {
            Caption = 'Video Url';
            DataClassification = SystemMetadata;
        }
        field(4; Category; Enum "Video Category")
        {
            Caption = 'Category';
            DataClassification = SystemMetadata;
        }
        field(5; "App ID"; Guid)
        {
            Caption = 'App ID';
            DataClassification = SystemMetadata;
            Editable = false;
        }
        field(6; "Extension Name"; Text[250])
        {
            Caption = 'Extension Name';
            DataClassification = SystemMetadata;
            Editable = false;
        }
    }

    keys
    {
        key(PK; EntriesNo)
        {
            Clustered = true;
        }
    }

    trigger OnInsert()
    var
        NewProductVideoLinks: Record NewProductVideoLink;
        LastEntriesNumber: Integer;
        Info: ModuleInfo;
    begin
        LastEntriesNumber := 0;
        NewProductVideoLinks.Reset();
        if NewProductVideoLinks.FindLast() then
            LastEntriesNumber := NewProductVideoLinks.EntriesNo + 1
        else
            LastEntriesNumber := 1;
        NavApp.GetCurrentModuleInfo(Info);
        EntriesNo := LastEntriesNumber;
        "App ID" := Info.Id;
        "Extension Name" := Info.Name;
    end;
}

page 80101 NewProductVideoLinks
{
    Caption = 'New Product Video Links';
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = NewProductVideoLink;

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field(Title; Rec.Title)
                {
                    ToolTip = 'Specifies the value of the Title field.';
                    ApplicationArea = All;
                }
                field("Video Url"; Rec."Video Url")
                {
                    ToolTip = 'Specifies the value of the Video Url field.';
                    ApplicationArea = All;
                }
                field(Category; Rec.Category)
                {
                    ToolTip = 'Specifies the value of the Category field.';
                    ApplicationArea = All;
                }
                field("App ID"; Rec."App ID")
                {
                    ToolTip = 'Specifies the value of the App ID field.';
                    ApplicationArea = All;
                }
                field("Extension Name"; Rec."Extension Name")
                {
                    ToolTip = 'Specifies the value of the Extension Name field.';
                    ApplicationArea = All;
                }
            }
        }
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL