How to Add a Print Action to the BarTender Print Connector for Dynamics 365 Business Central
Overview
This guide is for Business Central developers only. It assumes that you know and understand:
- The process to create a page extension in VS code
- The basics of AL programming
- How to publish changes from VS code to a sandbox environment
- App deployment to Production environments
See the guide below for instructions on creating a custom Print Action for use with BarTender Cloud and the BarTender Print Connector for Dynamics 365 Business Central.
Applicable to
BarTender Cloud
BarTender Print Connector for Dynamics 365 Business Central
Information
For Card, Document, or Subform Pages
- Add the code below to your page extension.
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";
- Change the _rec: Record Item variable to _rec: Record <SourceTable.Name> of the page extension.
- Find the Datasase::Item and replace it with Database::<SourceTable.Name>.
For List Pages
- Add the code below to your page extension.
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";
- Change the _rec: Record Item variable to _rec: Record <SourceTable.Name> of the page extension.
- Find the Datasase::Item and replace it with Database::<SourceTable.Name>.
Additional Resources
Installing and Setting Up the BarTender Print Connector for Dynamics 365 Business Central
Printing With the BarTender Print Connector for Dynamics 365 Business Central