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.
![](https://yzhums.com/wp-content/uploads/2022/01/image-148-1024x516.png)
Or, choose the Tell me icon, enter Product Videos, and then choose the related link.
![](https://yzhums.com/wp-content/uploads/2022/01/image-149-1024x516.png)
Default Video Library for Business Central:
![](https://yzhums.com/wp-content/uploads/2022/01/image-150-1024x516.png)
First of all this page is not editable, and the source table of this page is temporary.
![](https://yzhums.com/wp-content/uploads/2022/01/image-151-1024x516.png)
The Extensible property of page 1470 “Product Videos” is false.
![](https://yzhums.com/wp-content/uploads/2022/01/image-152-1024x819.png)
The Access property of table 1470 “Product Video Buffer” is Internal.
![](https://yzhums.com/wp-content/uploads/2022/01/image-153.png)
So it seems impossible to add our new video links. Please don’t give up, this time we can use Video (Codeunit 3710).
![](https://yzhums.com/wp-content/uploads/2022/01/image-154-1024x666.png)
For example:
![](https://yzhums.com/wp-content/uploads/2022/01/image-159-1024x166.png)
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.
![](https://yzhums.com/wp-content/uploads/2022/01/image-160-1024x516.png)
PS: You can use personalization to display App ID and Category on the page.
![](https://yzhums.com/wp-content/uploads/2022/01/image-157-1024x516.png)
![](https://yzhums.com/wp-content/uploads/2022/01/image-158-1024x516.png)
If you need more flexible design, you can add a new manage page for video links.
![](https://yzhums.com/wp-content/uploads/2022/01/image-161-1024x298.png)
New table:
![](https://yzhums.com/wp-content/uploads/2022/01/image-162-442x1024.png)
New table logic:
![](https://yzhums.com/wp-content/uploads/2022/01/image-163.png)
New Page:
![](https://yzhums.com/wp-content/uploads/2022/01/image-164-708x1024.png)
Codeunit:
![](https://yzhums.com/wp-content/uploads/2022/01/image-165-1024x270.png)
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
コメント