# Session.UnbindSubscription(Codeunit) Method
> Version: _Available or changed with runtime version 1.0._
Unbinds the event subscriber methods from in the codeunit instance. This essentially deactivates the subscriber methods for the codeunit instance.
## Syntax
```al
[Ok := ]  Session.UnbindSubscription(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 unbind 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.
Calling this method on a codeunit that hasn't been bound \(by the session-bindsubscription-method\) will result in an error. If the call to this method is successful, all bindings are removed.
The codeunit instance that is unbound will be the same instance that previously was bound.
## Example
The following sample code illustrates a typical use of the BindSubscription method.
```al
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".
  UNBindSubscription(SubscriberCodeunit888);  // Now deactivating again
  DoStuff(…);  // This time no events are raised inside SubscriberCodeunit888;

end;

```
## 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-unbindsubscription-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-unbindsubscription-method/
