Version: Available or changed with runtime version 1.0.
Binds the event subscriber methods in the codeunit to the current codeunit instance for handling the events that they subscribe to. This essentially activates the subscriber functions for the codeunit instance.
[Ok := ] Session.BindSubscription(Codeunit: Codeunit)
This method can be invoked without specifying the data type name.
The codeunit that contains the event subscribers.
true if the event subscriber methods bind successfully to the codeunit instance and no errors occurred, otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
You can only call this method on codeunits that have the EventSubscriberInstance Property set to Manual.
The codeunit instance that event subscribers are bound to will be this exact instance. Events will be raised on this instance. You can't bind the same instance more than once, but you can bind multiple instances of the same codeunit. This condition will result in an event subscriber call on each bound instance when a given event is raised.
The following sample code illustrates a typical use of the BindSubscription method.
Method MyFunction(….) LocalVar SubScriberCodeunit5000; begin // Set global information on the subscriber codeunit if required // You can rely on the instance being the same as the one receiving the event subscriber call SubScriberCodeunit5000.MySetGlobalInfo(<info you can later test in the subscriber event method>) BindSubscription(SubscriberCodeunit5000); DoSomething(…); // After binding, all subscriptions on SubscriberCodeunit5000 are "active". end; // Notice, that when SubScriberCodeunit5000 goes out of scope, all bindings are removed.
Submit and view feedback for