Extensibility
The Australia/New Zealand Accelerator publishes integration events and public procedures so that a partner extension can change behaviour, add data, or drive a process unattended without us having to change the app.
This page is the reference for the application extensibility surface. Extending the document layouts and report datasets is covered separately in Extending Theta Document Templates.
Objects and members not listed here are internal. Internal members can change at any time without notice, so please do not take a dependency on them. If you need something that is not published, contact us and we will look at exposing it.
Where an event is published from a table extension, the publishing object is the standard Business Central table, so subscribe with Database::"Sales Invoice Header" rather than the extension. These events carry the _ACC_TSL suffix in the event name.
Running processes unattended
These procedures let another extension run the payment suggestion and EFT processes from a job queue or an API, with no user interaction.
Suggest Customer Payments / Suggest Vendor Payments
report 70254475 "Sug. Customer Payments_ACC_TSL" and report 70254477 "Sugg. Vendor Payments_ACC_TSL".
| Procedure | Purpose |
|---|---|
InitializeRequest(...) | Sets the request page options (last payment date, payment discount, available amount, posting date, starting document no., summarise per customer/vendor, balancing account, bank payment type) so the report can be run without showing the request page. |
SetGenJnlLine(GenJournalLine) | Sets the journal template and batch that the suggested lines are written to. |
SetSuppressConfirmDialogs(Boolean) | Suppresses the confirmation dialogs the batch job would normally show. |
SetMaxLinesToProcess(Integer) | Caps the number of journal lines a single run will create. Use this to split a large payment run across several journal batches. |
GetLinesProcessed() | Returns the number of lines the run actually created, so the caller knows whether more runs are needed. |
SetIsDirectCredit() | Suggest Customer Payments only. Marks the run as a direct credit (customer refund) run. |
A batched run looks like this:
SuggVendorPayments.InitializeRequest(LastPmtDate, false, 0, false, PostingDate, StartDocNo, true, BalAccType, BalAccNo, BankPmtType);
SuggVendorPayments.SetGenJnlLine(GenJournalLine);
SuggVendorPayments.SetSuppressConfirmDialogs(true);
SuggVendorPayments.SetMaxLinesToProcess(500);
SuggVendorPayments.UseRequestPage(false);
SuggVendorPayments.RunModal();
LinesCreated := SuggVendorPayments.GetLinesProcessed();
Generating and sending the EFT file
| Object | Procedure | Purpose |
|---|---|---|
codeunit 70254471 "Generate EFT Payment_ACC_TSL" | Initialize(...) | Prepares the EFT Transfer header - bank account, transaction date, document no., description, summarisation, posting date update, and transaction type. Call this and then run the codeunit with the Gen. Journal Batch. |
codeunit 70254471 "Generate EFT Payment_ACC_TSL" | WarnIfMultipleEntriesForSameCustOrVendor(...) | Performs the same duplicate payment check that the Generate EFT Payments report performs before it generates. |
codeunit 70254471 "Generate EFT Payment_ACC_TSL" | GetReferenceText(EFTTransferLine) | Returns the reference text for an EFT Transfer Line. |
codeunit 70254470 "EFT Management_ACC_TSL" | GenerateEFTFile(EFTTransferHeader) | Creates the EFT export file and updates the EFT File Status. |
codeunit 70254470 "EFT Management_ACC_TSL" | SendEFTFileToBank(EFTTransferHeader, ShowConfirmation) | Sends the file using the bank's host-to-host integration. Pass false for ShowConfirmation when running unattended. Requires a Premium subscription. |
tableextension 70254477 on Gen. Journal Line | GetEFTTransferHeader_ACC_TSL(EFTTransferHeader, ShowMessage) | Returns the EFT Transfer created from a payment journal line. Pass false for ShowMessage when running unattended. |
WarnIfMultipleEntriesForSameCustOrVendor takes a WarningType of Notification, Confirmation or Show Duplicate List. When there is no client, pass Notification - the notification is discarded - and act on the returned warning text instead. Passing Confirmation will wait on a confirmation that nobody can answer.
To pick the generated file up in your own code rather than downloading it, subscribe to EFTFileGeneratingProcessCompleted, which passes the generated file as a TempBlob.
Banking and EFT events
EFT file generation and transmission
codeunit 70254470 "EFT Management_ACC_TSL"
| Event | Raised |
|---|---|
EFTFileGeneratingProcessCompleted | After the EFT file has been generated. Passes the EFT Transfer header, the download-to-client flag, and the generated file as a TempBlob. |
EFTFileStatusChanged | When the EFT File Status changes. |
OnBeforeCancelEFTFile | Before an EFT file is cancelled. |
OnBeforeChangeEFTFileStatusToUploadingToBankBeforeGeneratingFile | Before the status is set to Uploading to Bank as part of generating the file. |
The file is only written to internal temp storage when it is actually needed - that is, when the bank account is set to download to client or upload to external storage, or when there is an active subscriber to EFTFileGeneratingProcessCompleted.
EFT payment generation
codeunit 70254471 "Generate EFT Payment_ACC_TSL"
| Event | Raised |
|---|---|
OnBeforeGetReferenceText / OnAfterGetReferenceText | Around building the reference text for an EFT Transfer Line. |
OnBeforeGetReferenceTextHeader / OnAfterGetReferenceTextHeader | Around building the reference text for the EFT Transfer header. |
OnAfterTryGetVendorAccountDetails | After the vendor bank account details have been resolved for a payment line. |
OnBeforeInsertEFTLine | Before each EFT Transfer Line is inserted. |
OnBeforeUpdateRecipientBankAccountNo | Before the recipient bank account number is set on the journal line. |
report 70254471 "GenerateEFTPayments_ACC_TSL"
| Event | Raised |
|---|---|
OnBeforeFindDefaultBankAccount / OnAfterFindDefaultBankAccount | Around resolving the default bank account for the run. |
EFT feedback from the bank
codeunit 70254426 "ProcessEFTFeedback_ACC_TSL"
| Event | Raised |
|---|---|
OnResolveEFTTransferHeaderFallback | When the standard EFT Transfer header lookup fails. Lets a bank-specific extension supply the header - for example by matching on the bank's own message reference. See EFT Transfers. |
OnBeforeGetEffectiveEFTFileNo | Before the effective EFT file number is resolved. Lets a subscriber override which file the feedback applies to. |
OnBeforeGetEffectiveEFTFileLineNo | Before the effective EFT line number is resolved. Lets a subscriber override which line the feedback applies to. |
OnBeforePostJournals | After all feedback lines have been processed and before the journal is auto-posted. |
codeunit 70254418 "Journal Posting_ACC_TSL"
| Event | Raised |
|---|---|
OnBeforeAutoPostJournal | Before a journal is automatically posted. |
EFT Transfer Lines
table 70254474 "EFTTransferLine_ACC_TSL"
| Event | Raised |
|---|---|
OnBeforeSendRecords | Before remittance or payment advice documents are sent from the EFT lines. |
OnBeforeEmailRecords | Before remittance or payment advice documents are emailed from the EFT lines. |
OnBeforeShowAppliedEntriesAfterSourceLedgerEntryCheck | Before the applied entries are shown from an EFT line. The EFT File Line is passed by var. |
Suggest Customer Payments
report 70254475 "Sug. Customer Payments_ACC_TSL"
| Event | Raised |
|---|---|
CheckRefundSuggestionRule | Lets you override the standard rule that only suggests a refund when there is an amount owing. |
OnBeforeGetCustomerBankAccount | Lets a subscriber resolve the customer bank account for one suggested line instead of using the customer-wide default. |
OnBeforeHandledCustLedgEntry | Before a customer ledger entry is handled. Use to skip or change handling of an entry. |
OnGetCustLedgEntriesOnBeforeLoop | Before the customer ledger entry loop starts. Use to change the filters applied. |
Suggest Vendor Payments
report 70254477 "Sugg. Vendor Payments_ACC_TSL"
| Event | Raised |
|---|---|
OnAfterPreReport | After the report's pre-report processing. |
OnAfterAfterGetRecordVendor | After each vendor has been processed. |
OnGetVendLedgEntriesOnBeforeLoop | Before the vendor ledger entry loop starts. Use to change the filters applied. |
OnBeforeHandledVendLedgEntry | Before a vendor ledger entry is handled. Use to skip or change handling of an entry. |
OnUpdateTempVendorPaymentBufferFromVendorLedgerEntry | While the payment buffer is being built from a vendor ledger entry. |
OnAfterUpdateTempVendorPaymentBuffer | After the payment buffer has been updated. |
OnBeforeUpdateGnlJnlLineDimensionsFromTempVendorPaymentBuffer / OnAfterUpdateGnlJnlLineDimensionsFromTempVendorPaymentBuffer | Around copying dimensions from the payment buffer to the journal line. Use to override the dimensions applied to payment journals. |
OnBeforeInsertGenJournalLine | Before each suggested journal line is inserted. |
OnBeforeTryGetEFTVendorBankAccount | Before the EFT vendor bank account is resolved for a suggested line. |
Bank account validation and workflow
| Object | Event | Raised |
|---|---|---|
tableextension 70254474 on Customer Bank Account | OnBeforeTryGetEFTCustomerBankAccount_ACC_TSL | Lets an app resolve the EFT bank account itself instead of using the customer-wide default. |
tableextension 70254472 on Vendor Bank Account | OnBeforeCheckDefaultBankAccount_ACC_TSL | Before the default vendor bank account is checked. |
codeunit 70254482 "Workflow Event_ACC_TSL" | OnBeforeProcessingCustBankAccChangedWorkFlow | Before the customer bank account changed workflow is processed. |
codeunit 70254482 "Workflow Event_ACC_TSL" | OnBeforeProcessingVendorBankAccChangedWorkFlow | Before the vendor bank account changed workflow is processed. |
Host-to-host integration and bank statements
| Object | Event | Raised |
|---|---|---|
codeunit 70254413 PaymentPublisher_ACC_TSL | OnAfterEFTPaymentResponseRetrieved | After the bank's payment response has been retrieved. |
codeunit 70254413 PaymentPublisher_ACC_TSL | OnAfterRetrievedPaymentPublisherStatus | After the payment publisher status has been retrieved. |
codeunit 70254411 "ProcessBankStatEntry_ACC_TSL" | OnBeforeGetBankStatementDate / OnAfterGetBankStatementDate | Around resolving the statement date for an imported bank statement entry. |
codeunit 70254448 "ProcessWestpacBankStat_ACC_TSL" | BankStatementEntriesReadyToProcess | When imported Westpac statement entries are ready to be processed. |
codeunit 70254449 "ProcessWindcaveBankSta_ACC_TSL" | BankStatementEntriesReadyToProcess | When imported Windcave settlement entries are ready to be processed. |
codeunit 70254449 "ProcessWindcaveBankSta_ACC_TSL" | OnBeforeImportWindcaveBankStatement / OnAfterImportWindcaveBankStatement | Around importing the Windcave settlement statement. |
Currency exchange rate events
See Currency Exchange Rate Service for the feature itself.
| Object | Event | Raised |
|---|---|---|
codeunit 70254454 "Currency Exchange Mgmt_ACC_TSL" | OnFetchCurrencyRates | Lets you implement a custom currency rate provider. |
table 70254442 "Curr. Provider_ACC_TSL" | OnBeforeCallTestConnection | Before the provider's Test Connection action calls the provider. |
Document sending and emailing events
See Document Configuration for the features these events relate to.
Sending and printing
| Object | Event | Raised |
|---|---|---|
codeunit 70254422 "DocumentSendingProfile_ACC_TSL" | OnBeforeAutoSendSalesOrderOrReturnOrder | Before a sales order or return order is sent automatically, so you can change the automatic sending behaviour. |
codeunit 70254422 "DocumentSendingProfile_ACC_TSL" | OnBeforeAutoSendSalesOrderBeforeCheckIfSentPreviously | Before the "already sent" check on automatic sales order sending. |
codeunit 70254422 "DocumentSendingProfile_ACC_TSL" | OnBeforeAutoSendPurchaseOrderBeforeCheckIfSentPreviously | Before the "already sent" check on automatic purchase order sending. |
report 70254423 "SendPostedSalesInv_ACC_TSL" | OnAfterCheckingCustomReportSelection | After the Send Posted Documents batch job has checked the custom report selection for a document. |
codeunit 70254459 "InvoiceAttachmentMgt_ACC_TSL" | OnAfterHandleAttachments | After the attachments for an emailed document have been assembled. See Merge Email Attachments. |
The following events are published from table extensions on standard tables:
| Base table | Events |
|---|---|
| Sales Invoice Header | OnBeforeSendProfileCustom_ACC_TSL, OnBeforeSendRecordsCustom_ACC_TSL, OnBeforePrintRecordsCustom_ACC_TSL, OnBeforeEmailRecordsCustom_ACC_TSL |
| Sales Shipment Header | OnBeforeSendRecords_ACC_TSL |
| Purchase Header | OnBeforeSendProfileCustom_ACC_TSL, OnBeforeSendRecordsCustom_ACC_TSL, OnBeforePrintRecordsCustom_ACC_TSL |
| Purch. Inv. Header | OnBeforeSendProfileCustom_ACC_TSL, OnBeforeSendRecordsCustom_ACC_TSL |
Email addresses and name formats
| Object | Event | Raised |
|---|---|---|
codeunit 70254410 "Doc. EMail Mgmt_ACC_TSL" | OnCustomGetTableFromUsage | Lets you map a custom report usage to the table it applies to, so your own documents can use the app's emailing. |
codeunit 70254410 "Doc. EMail Mgmt_ACC_TSL" | OnBeforeTryGetVariantFromDocNoUsage | Before the document record is resolved from the document number and usage. |
table 70254406 "EmailNameFormat_ACC_TSL" | OnBeforeValidateEmailAddress | Before an email address is validated. See Email Address Validation. |
table 70254406 "EmailNameFormat_ACC_TSL" | OnBeforeValidateForValidTokenThetaEFT | Before a token in an Email Name Format is validated. |
Report selection events
| Object | Event | Raised |
|---|---|---|
codeunit 70254408 "Report Selection Mgt._ACC_TSL" | OnBeforeCopyFromReportSelections | Before report selections are copied to customer document layouts. |
codeunit 70254408 "Report Selection Mgt._ACC_TSL" | OnBeforeAddModifyCustomLayoutFromUpdate | Before a customer document layout is added or modified by the automatic update. |
codeunit 70254408 "Report Selection Mgt._ACC_TSL" | OnBeforeAutoUpdateCustomerDocumentLayoutEmails | Before the email addresses on customer document layouts are updated automatically. |
codeunit 70254408 "Report Selection Mgt._ACC_TSL" | OnMapReportUsageToSalesReportUsage | Maps a report selection usage to the sales report usage. |
codeunit 70254408 "Report Selection Mgt._ACC_TSL" | OnMapReportUsageToCustomReportSelectionSales / OnMapCustomReportSelectionSalesToReportUsage | Map between the standard Report Selection Usage and Custom Report Selection Sales enums, so that a custom usage added by your extension is handled. See Report Usage Mapping. |
pageextension 70254406 on Report Selection - Sales | OnValidateUsage_ACC_TSL | When the usage is validated on the Report Selection - Sales page. |
OnMapReportUsageToCustomReportUsage is obsolete (tag 27.0) and will be removed. Use the standard enum mapping events above instead.
Document content events
These events change what appears on a Theta document. The layout side - custom fields, comment lines, and report extensions - is covered in Extending Theta Document Templates.
Document settings and custom fields
table 70254411 "ThetaDocumentSetting_ACC_TSL"
| Event | Raised |
|---|---|
OnBeforeGetTextValueForCustomTextWithDocLineBuffer | When the value for a custom text field is needed. This is the main event for adding calculated values to a document. |
OnBeforeOutputDocumentLines / OnAfterOutputDocumentLines | Around outputting the document lines. Use to reset globals, or to change the lines before they print. |
OnBeforeGetCustomFieldDefaults | Lets your extension define custom fields so they are created automatically when the extension is installed. See Defaulting Custom Fields. |
OnBeforeGetTableRelationDefaults | Lets your extension default the custom table relations used by custom fields. |
OnBeforeGetCustLayoutDefaults | Lets your extension default customer document layout selections. |
OnAfterGetReportSettings | After the report settings have been read. Use to apply defaults from your extension. |
OnAfterGetOrInsertReportSettingsDuringInstallOrUpgrade | When report settings are created during install or upgrade. See Defaulting Document Settings. |
OnAfterInitialiseReportSettingsForStandardThetaDocuments | Lets you initialise document settings for your own report when the extension is installed. |
OnBeforeAssignRecordRef | Before a record reference is assigned while resolving a field value. |
OnBeforeFormatField | Before a field value is formatted for output. |
OnBeforeFinishInitConfigurableSystemFields | Before initialisation of the configurable system fields completes. |
OnBeforeGenerateDocumentBarCode / OnBeforeGenerateDocumentBarCodeStandard | Before a barcode is generated for a document. See Barcodes on Documents. |
table 70254410 "ThetaDocCustomField_ACC_TSL"
| Event | Raised |
|---|---|
OnAssistSystemField | When the assist edit is used on a system field. |
OnValidateSystemField | When a system field is validated. |
Company details and extended text
| Object | Event | Raised |
|---|---|---|
table 70254400 "Doc. Template Setup_ACC_TSL" | OnAfterFormatCompanyAddress | After the company address has been formatted. The source document is passed so subscribers can interrogate document dimensions. |
table 70254418 "DocumentExtendedText_ACC_TSL" | OnBeforeAddSalesDocumentExtendedTextToDocLineBuffer | Before Document Extended Text is added to the document. |
codeunit 70254400 "Text Helper_ACC_TSL" | OnBeforePrepareDocLineDescription | Before a document line description is prepared, including wrapping. |
Document line buffers
| Object | Event | Raised |
|---|---|---|
table 70254401 "Sales Doc. Line Buffer_ACC_TSL" | OnAfterInsertSalesDocLineBuffer | After a sales document line buffer record is inserted. |
table 70254402 "Purch. Doc. Line Buf_ACC_TSL" | OnAfterInsertPurchDocLineBuffer | After a purchase document line buffer record is inserted. |
Document aggregation
codeunit 70254438 "DocAggrRepHandler_ACC_TSL" - see Document Aggregation.
| Event | Raised |
|---|---|
OnBeforeInsertAggregatedSalesDocLineBuffer | Before an aggregated buffer line is inserted, so you can change it. |
OnFindAggregatedLineByCustomField | Lets you aggregate by a custom field. |
Document report events
Most Theta documents publish the same small set of events. Rather than repeat them, they are described once here and the matrix below shows which reports publish which.
| Event | Raised |
|---|---|
OnBeforeCopyDocumentLineToDocLineBuffer | Before a source document line is copied into the document line buffer. Use to skip a line or pre-set buffer values. |
OnAfterCopyDocumentLineToDocLineBuffer | After a source document line has been copied into the document line buffer. Use to change buffer values. |
OnBeforeInsertingFreeLinesNeeded | Before the free (blank) lines needed to pad the page are inserted. |
OnBeforeAddingTrackingLines | Before lot and serial tracking lines are added to the document. |
OnBeforeInsertDocLineBuffer | Before a buffer line is inserted on the warehouse documents. |
Sales documents
| Report | Copy Before | Copy After | Free Lines | Tracking |
|---|---|---|---|---|
70254401 SalesQuote_ACC_TSL | Yes | Yes | Yes | |
70254402 SalesOrder_ACC_TSL | Yes | Yes | Yes | |
70254403 SalesCreditMemo_ACC_TSL | Yes | Yes | Yes | Yes |
70254404 SalesInvoice_ACC_TSL | Yes | Yes | Yes | Yes |
70254405 SalesShipment_ACC_TSL | Yes | |||
70254409 SalesCommercialInvoice_ACC_TSL | Yes | Yes | Yes | Yes |
70254415 SalesProformaInvoice_ACC_TSL | Yes | Yes | Yes | |
70254418 SalesReturnOrder_ACC_TSL | Yes | Yes | Yes | |
70254420 SalesReturnCollection_ACC_TSL | Yes | Yes | Yes | Yes |
70254426 SalesOrderPackSlip_ACC_TSL | Yes | Yes | Yes | Yes |
70254429 SalesProformaCredMemo_ACC_TSL | Yes | Yes | Yes |
Purchase documents
| Report | Copy Before | Copy After | Free Lines | Additional |
|---|---|---|---|---|
70254400 PurchBuyerCreatedInv_ACC_TSL | Yes | Yes | ||
70254406 PurchaseOrder_ACC_TSL | Yes | Yes | Yes | OnAfterAddCustVendItemNo |
70254408 DraftPurchaseInvoice_ACC_TSL | Yes | Yes | Yes | |
70254432 PurchaseQuote_ACC_TSL | Yes | Yes | Yes |
Warehouse and transfer documents
| Report | Copy Before | Copy After | Free Lines | Tracking | Additional |
|---|---|---|---|---|---|
70254416 WhsePackingSlip_ACC_TSL | Yes | Yes | Yes | OnBeforeInsertDocLineBuffer, OnBeforeDocumentDetailHeaderfilter | |
70254419 WhseInternalPick_ACC_TSL | Yes | Yes | OnBeforeInsertDocLineBuffer | ||
70254421 WhseShipment_ACC_TSL | Yes | Yes | Yes | OnBeforeAddSourceDocInfo, OnBeforePrepareShipToAddress | |
70254422 WhseShipmentPosted_ACC_TSL | Yes | Yes | Yes | OnBeforeAddSourceDocInfo, OnBeforePrepareShipToAddress | |
70254427 TransferOrder_ACC_TSL | Yes | Yes | Yes | ||
70254431 TransferShipment_ACC_TSL | Yes | Yes | Yes |
OnBeforeDocumentDetailHeaderfilter lets you change the filters applied to the document detail header. OnBeforeAddSourceDocInfo lets you change the source document information shown per shipment, and OnBeforePrepareShipToAddress lets you change the address details shown per shipment.
Customer Statement
report 70254424 "CustomerStatementBBF_ACC_TSL" - see Customer Statement.
| Event | Raised |
|---|---|
OnBeforeInsertTempCustomerStatementBuf | Before a statement buffer line is inserted. |
OnBeforeModifyCustomerStatementLine | Before a statement line is modified. |
OnBeforeUpdateOfLineCounter | Before the line counter is updated. |
OnBeforeWrapDescriptionText | Before the description is wrapped. |
OnBeforeInsertWrappedDescriptionLine | Before a wrapped description line is inserted. |
OnBeforeAssignAgingBandColumnHeaders | Before the ageing band column headings are assigned. |
Warehouse events
| Object | Event | Raised |
|---|---|---|
codeunit 70254423 "WarehouseDocumentMgt_ACC_TSL" | OnBeforeGetLotSerialInformationText | Before the lot and serial information text is built for a warehouse document. |
codeunit 70254414 "WarehouseMgtSubscriber_ACC_TSL" | OnAfterIntegrationStagingEntryCreatedForNewPick | After a staging entry has been created for a new pick. |
codeunit 70254414 "WarehouseMgtSubscriber_ACC_TSL" | OnAfterIntegrationStagingEntryCreatedForRegisterdPick | After a staging entry has been created for a registered pick. |
table 70254419 "RegWhseActivityDetail_ACC_TSL" | OnBeforePrintRecords | Before registered warehouse activity records are printed. |
codeunit 70254415 "RegWhse.-Printed_ACC_TSL" | OnBeforeModify | Before the printed flag is written back to the registered warehouse activity. |