如何在 Dynamics 365 Business Central 的 BarTender 打印连接器中添加打印操作
概述
本指南仅适用于 Business Central 开发人员。假设您已经了解并掌握以下内容:
- 在 VS code 中创建页面扩展的流程
- AL 编程的基础知识
- 如何将更改从 VS code 发布到沙盒环境
- 应用部署到生产环境
请参阅下方指南,了解如何为 BarTender Cloud 和 Dynamics 365 Business Central 的 BarTender 打印连接器创建自定义打印操作。
适用范围
BarTender Cloud
Dynamics 365 Business Central 的 BarTender 打印连接器
信息
适用于卡片、文档或子表单页面
- 将以下代码添加到您的页面扩展中。
actions
{
addfirst(processing)
{
group(SSBT_Actions)
{
Caption = 'Seagull Bartender';
Image = Action;
action(SSBT_PrintSelected)
{
ApplicationArea = All;
Caption = 'Print';
Image = Print;
ToolTip = 'Print record.'
trigger OnAction()
var
_rec: Record Item;
_recRef: RecordRef;
begin
SetSelectionFilter(_rec);
_recRef.Open(Database::Item);
_recRef.Copy(_rec);
SSBTPrintMgmt.PrintBartender(_recRef, true);
end;
}
}
}
}
var
SSBTPrintMgmt: Codeunit "SSBT Print Mgmt";
- 将 _rec: Record Item 变量更改为页面扩展的 _rec: Record <SourceTable.Name>。
- 找到 Datasase::Item ,并将其替换为 Database::<SourceTable.Name>.
适用于列表页面
- 将以下代码添加到您的页面扩展中。
actions
{
addfirst(processing)
{
group(SSBT_Actions)
{
Caption = 'Seagull Bartender';
Image = Action;
action(SSBT_PrintSelected)
{
ApplicationArea = All;
Caption = 'Print selected';
Image = Print;
ToolTip = 'Print selected records.';
trigger OnAction()
var
_rec: Record Item;
_recRef: RecordRef;
begin
SetSelectionFilter(_rec);
_recRef.Open(Database::Item);
_recRef.Copy(_rec);
SSBTPrintMgmt.PrintBartender(_recRef, true);
end;
}
action(SSBT_PrintAll)
{
ApplicationArea = All;
Caption = 'Print all';
Ellipsis = true;
Image = SendToMultiple;
ToolTip = 'Print all records.';
trigger OnAction()
var
_recRef: RecordRef;
begin
_recRef.Open(Database::Item);
_recRef.Copy(Rec);
SSBTPrintMgmt.PrintBartender(_recRef, false);
end;
}
}
}
}
var
SSBTPrintMgmt: Codeunit "SSBT Print Mgmt";
- 将 _rec: Record Item 变量更改为页面扩展的 _rec: Record <SourceTable.Name>。
- 找到 Datasase::Item ,并将其替换为 Database::<SourceTable.Name>.