The standard Business Central Sales Invoice and Good Looking Documents Sales Invoice support Payment Links.
This is a technical document on how to add Payment Link to a custom report. Use the following steps integrate the Payment Reporting Argument object into both the report object and layout.
Update the Report Structure
You need to add a new DataItem
and implement the OnAfterGetRecord
trigger.
Add the Payment Reporting Argument Data Item
Include the PaymentReportingArgument
as a child of your header data item (e.g., Sales Invoice Header
):
dataitem(PaymentReportingArgument; "Payment Reporting Argument")
{
DataItemTableView = sorting(Key);
UseTemporary = true;
column(PaymentServiceLogo; Logo) {}
column(PaymentServiceLogo_UrlText; "URL Caption") {}
column(PaymentServiceLogo_Url; GetTargetURL()) {}
column(PaymentServiceText_UrlText; "URL Caption") {}
column(PaymentServiceText_Url; GetTargetURL()) {}
}
Implement the OnAfterGetRecord Trigger
Call the CreateReportingArgs
function in the OnAfterGetRecord
trigger of your header data item:
PaymentServiceSetup.CreateReportingArgs(PaymentReportingArgument, Header);
Update the Report Layout
In your report layout, use the columns defined earlier in the PaymentReportingArgument
data item:
Field | Action |
---|---|
Add Payment Service Logo | Place the PaymentServiceLogo column in the desired position in the layout. |
Add URLs for Payment Services | Use the PaymentServiceLogo_Url and PaymentServiceText_Url to create clickable links or buttons in the layout. For instance, you might want to label them clearly for user interaction. |