Integration Events for Developers
Connector 365 Addressee Control provides various integration events that allow developers to extend the app’s functionality and adapt it to specific requirements.
This documentation is intended for AL developers. Basic knowledge of Business Central extension development is required.
OnBeforeGetRecipients
This event is called before recipient addresses are determined. It allows complete control over the recipient determination process.
Usage
1
2
3
4
5
6
|
[IntegrationEvent(false, false)]
local procedure OnBeforeGetRecipients(
BaseParameters: Record "BEL365 Base Parameters";
var TempRecipient: Record "BEL365 Temp Recipient" temporary;
var OverrideRecipients: Boolean
)
|
Parameters
| Parameter |
Type |
Description |
| BaseParameters: Record “BEL365 Base Parameters” |
Contains all relevant parameters for the current operation |
|
| TempRecipient |
Record “BEL365 Base Parameters” temporary |
Temporary table for recipients. Can be populated to supplement or replace default recipients |
| OverrideRecipients |
Boolean |
If set to true, the standard logic will be skipped |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
[EventSubscriber(ObjectType::Codeunit, Codeunit::"BELADC Addressee Control Mgmt", 'OnBeforeGetRecipients', '', false, false)]
local procedure OnBeforeGetRecipientsCustom(
BaseParameters: Record "BEL365 Base Parameters;
var TempRecipient: Record "BEL365 Temp Recipient temporary;
var OverrideRecipients: Boolean
)
var
SalesHeader: Record "Sales Header";
DocumentRecRef: RecordRef;
begin
DocumentRecRef.GetTable(BaseParameters."Record ID");
if DocumentRecRef.Number <> Database::"Sales Header" then
exit;
DocumentRecRef.SetTable(SalesHeader);
// Example: Always inform management for VIP customers
if IsVIPCustomer(SalesHeader."Sell-to Customer No.") then begin
AddRecipient(TempRecipient, 'management@company.com', TempRecipient."Recipient Type"::CC);
end;
end;
|
This event enables support for custom document types that are not supported by default in the app.
Usage
1
2
3
4
5
6
|
[IntegrationEvent(false, false)]
local procedure OnGetHeaderFromReportUsageOnCaseElse(
ReportUsage: Enum "Report Selection Usage";
PostedDocNo: Code[20];
var DocumentHeaderVariant: Variant
)
|
Parameters
| Parameter |
Type |
Description |
| ReportUsage |
Enum “Report Selection Usage” |
The report usage |
| PostedDocNo |
Code[20] |
The document number to get the document header |
| DocumentHeaderVariant |
Variant |
The document header to be returned |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[EventSubscriber(ObjectType::Codeunit, Codeunit::"CBC Document Header Mgt.", 'OnGetHeaderFromReportUsageOnCaseElse', '', false, false)]
local procedure HandleCustomDocumentType(
ReportUsage: Enum "Report Selection Usage";
PostedDocNo: Code[20];
var DocumentHeaderVariant: Variant;
)
var
Job: Record Job;
begin
if ReportUsage = ReportUsage::JQ then
if Job.Get(PostedDocNo) then
DocumentHeaderVariant := Job
end;
|
OnIsReportUsageSupportedOnCaseElse
This event allows marking additional report usages as supported that are not recognized by default in the app.
Usage
1
2
3
4
5
|
[IntegrationEvent(false, false)]
local procedure OnIsReportUsageSupportedOnCaseElse(
ReportUsage: Enum "Report Selection Usage";
var Supported: Boolean
)
|
Parameters
| Parameter |
Type |
Description |
| ReportUsage |
Enum “Report Selection Usage” |
The report usage to check |
| Supported |
Boolean |
Must be set to true for the usage to be supported |
Example
1
2
3
4
5
6
7
8
9
10
11
12
|
[EventSubscriber(ObjectType::Codeunit, Codeunit::"CBC Report Usage Mgt.", 'OnIsReportUsageSupportedOnCaseElse', '', false, false)]
local procedure OnIsReportUsageSupportedCustom(
ReportUsage: Enum "Report Selection Usage";
var Supported: Boolean
)
begin
// Example: Support for custom report usage
case ReportUsage of
ReportUsage::Job
Supported := true;
end;
end;
|
Use Case
Use this event when you:
- Have created your own report usages
- Want to enable Addressee Control functionality for these usages
- Need to enable address priority setup for custom reports
OnBeforeSetDefaultAddressPrioritiesForUsage
This event is called before default address priorities are set for a report usage. It allows defining custom default priorities for custom report usages.
Usage
1
2
3
4
5
|
[IntegrationEvent(false, false)]
local procedure OnBeforeSetDefaultAddressPrioritiesForUsage(
ReportUsage: Enum "Report Selection Usage";
var IsHandled: Boolean
)
|
Parameters
| Parameter |
Type |
Description |
| ReportUsage |
Enum “Report Selection Usage” |
The report usage for which priorities are being set |
| IsHandled |
Boolean |
Must be set to true to replace the standard logic |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
[EventSubscriber(ObjectType::Codeunit, Codeunit::"CBC Address Priority Setup", 'OnBeforeSetDefaultAddressPrioritiesForUsage', '', false, false)]
local procedure OnBeforeSetDefaultAddressPrioritiesCustom(
ReportUsage: Enum "Report Selection Usage";
var IsHandled: Boolean
)
var
Field: Record Field;
CustomReportSelectionSetup: Record "BELADC Cus. Rep. Sel. Mapping";
AddressPriority: Record "BELADC Address Priority";
AddresseeControlMgmt: Codeunit "BELADC Addressee Control Mgmt";
begin
if ReportUsage <> ReportUsage::Job then
exit;
CustomReportSelectionSetup."Report Usage" := ReportUsage;
CustomReportSelectionSetup."Cus. Rep. Select. Field No." := 2;
if Field.Get(AddresseeControlMgmt.GetTableIdFromReportUsage(ReportUsage), CustomReportSelectionSetup."Cus. Rep. Select. Field No.") then begin
CustomReportSelectionSetup."Cus. Rep. Select. Field Name" := Field."Field Caption";
CustomReportSelectionSetup.Insert();
end;
AddressPriority.Init();
AddressPriority.NewRecord();
AddressPriority."Target Table No." := Database::"Custom Report Selection";
AddressPriority."Target Field No." := 9;
if AddressPriority.Insert() then;
IsHandled := true;
end;
|
Use Case
Use this event when you:
- Want to define default address priorities for custom report usages
- Need to ensure consistent setup across multiple companies
- Want to automate the manual setup of address priorities
Best Practices
- Always check the record type: Use
RecordRef.Number or RecordRef.Name to ensure you’re processing the correct record
- Set IsHandled or OverrideRecipients consciously: These parameters determine whether standard processing is performed
- Test thoroughly: Events deeply integrate into core logic and should be extensively tested
- Document your extensions: Keep track of which events you use and why
For detailed technical information and additional events, please consult the AL object documentation in your development environment or contact BELWARE Support.
Compatibility
| Event |
Available from Version |
| OnBeforeGetRecipients |
1.12.0.0 |
| OnIsReportUsageSupportedOnCaseElse |
1.14.0.0 |
| OnBeforeSetDefaultAddressPrioritiesForUsage |
1.14.0.0 |
| OnGetHeaderFromReportUsageOnCaseElse |
1.15.0.0 |
Events may change in future versions. Please refer to the release notes when updating the app.