#023 ISOLATED EVENTS

Skip to content

#023 ISOLATED EVENTS

From D365BC 2022 Wave 1 Release (a.k.a. BC20), events definition have a new parameter: Isolated. When set to true, the event runs in an isolated mode, meaning that even if the event fails the application will not throw an error, and other calls will continue to be executed without a critical error stopping it.

For example, it is usual for partners to add business logic to the login process, which is normally added to the OnAfterLoginStart event of the LogInManagement Codeunit. Unfortunately, these often raise errors and break the sign-in process.  Given that, Microsoft is replacing that event by the new OnAfterLogin event in the System Initialization Codeunit, which is an Isolated Event.

 

With this new feature, subscribing an isolated event will grant us that even if the code breaks, the further code will continue to be executed.

How to create and subscribe an Isolated Event:

1. Create an Integration Event and set the Isolated parameter to true:

Create an Integration Event and set the Isolated parameter to true

2. Subscribe the event and add an error message:

Subscribe the event and add an error message

3. Open the Page where the Event is published. There are two possible outcomes depending on the Event definition Isolated parameter:

a. If Isolated = true: The page opens without breaking on the Error occurrence;

b. If Isolated = false: The page opens and the error is thrown (the behavior as seen in previous versions).