# Session.BindSubscription(Codeunit) Method
> 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.
## Syntax
```al
[Ok := ]  Session.BindSubscription(Codeunit: Codeunit)
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
Codeunit
Type: ../codeunit/codeunit-data-type
The codeunit that contains the event subscribers.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
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.
## Remarks
You can only call this method on codeunits that have the ../../properties/devenv-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.
## Example
The following sample code illustrates a typical use of the BindSubscription method.
```al
procedure MyFunction()
var
    Subscriber: Codeunit Subscriber;
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

    Subscriber.MySetGlobalInfo(123); //info you can later test in the subscriber event method
    BindSubscription(Subscriber);
    DoSomething();  // After binding, all subscriptions on Subscriber are "active".
end; // Notice, that when Subscriber goes out of scope, all bindings are removed.

```
## Related information
session-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/session/session-bindsubscription-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/session/session-bindsubscription-method/
