Eventing is major part while upgrading to business central, we face alot of customisation done in Customer database which needs to be evented and converted into extension.
You subscribe to events to extend application and interact with the base application and other extensions. This topic describes how to discover events that you can subscribe to without writing the code manually
I suggest you to see the topic mentioned below before moving further on this
Specify the type of object that publishes the event. This can be Codeunit, Page, Report, Table, or XMLPort.
<Event Publisher Object>
Specify the object that publishes the event. You can set this to the ID, such as 50100, or the recommended way is to use the object name by using the syntax <Object Type>::"<Object Name>", such as Codeunit::"MyPublishers", or for database triggers Database::"Customer".
<Published Event Name>
Specify the name of method that publishes the event in the object that is specified by the <Event Publisher Object> parameter.
<Published Event Element Name>
Specifies the table field that the trigger event pertains to. This argument only requires a value for database trigger events, that is, when the <Event Publisher Object Type> is set to Table and the <Published Event Name> argument is a validate trigger event, such as OnAfterValidateEvent.
Set to true to skip the event subscriber method call if the user’s license does not cover the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default.
Set to true to skip the event subscriber method call if the user does not have the correct permissions the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default.
Try to post an output journal with Long Description and you can view the Long Description in Capacity Ledger entry after posting.
Self Learning Link by microsoft.
To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn
We will first create Page Extension for Customer Card.
We will add a Text Var to display “Posted Sales Invoice Count” on Customer card and add the same in General Tab .
When a page background task is enqueued, parameters are passed as a dictionary of text to the codeunit’s OnRun trigger when the page background task session is started.
OnPageBackgroundTaskCompleted trigger of the page in the parent session is called, and the results of the task are passed to the trigger. The results are passed as a dictionary of text.
When an error occurs in the page background task codeunit, this trigger of the page in the parent session is automatically called and we need to handle the error.
Create a background task codeunit.
You need to create a new codeunit which will do all the calculation and run it in background. After the calculation have been performed the it needs to be passed back to the calling page for handling through SetBackgroundTaskResult and get data from Parent session through GetBackgroundParameters .
This was complete overview of the process. You can try this and improve the performace of the pages.