Business Central SaaS – Kill Sessions

It could happen that the messages “another user has modified” or “a table is locked by another user” appear, in this case you have to wait for the situation to be unlocked, by letting the users out or waiting.

Currently the only way to break the deadlocks

  • wait and wait…

  • get all users out, check that the situation has been unlocked

  • try to enter data with another user in the same tables.. do something in tables to unlock….

  • .. finally ask Microsoft to reset the instance (at night) by opening a ticket.

Surely they will be working on a better management of the sessions through telemetry or other .. I don’t know. To date, the only solution that came to my mind is to do the old way, that is, to install a session killer in BC SaaS.

In practice it is possible to see the active sessions but it is not possible to delete them, to do this it is necessary to install the usual page that takes care of killing the active sessions.

*** DISCLAIMER ***

“Obviously it is not recommended to use it! it has been tested in a sandbox but also works in a production environment.”

The “Active Sessions” Table

You can open Sessions and Active Sessions tables

https://businesscentral.dynamics.com/?table=2000000110

…but you can only see the list of All open sessions, nothing more as the table is read-only (a SQL view) in read only state by Design).

The “KILL ACTIVE SESSION” Page

With this simple sample Page (Kill Active Session), you can filter and delete the selected Session.

Install the extension

Download Link on GitHub

https://github.com/rstefanetti/AL-Samples/tree/AL-Kill-Sessions

“HOW-TO”

#1 – Search for “Active Session” page

#2 – Filter the needs session

#3 – Select the line and run “Delete Line”

#4 – The system show the Confirmation Message “Go ahead and delete ?”

.. and immediately…. The Session if Killed!

… and after some second… the user is disconnected from the browser because the session has been killed!

YOUR SESSIONS IS EXPIRED! ….

4 thoughts on “Business Central SaaS – Kill Sessions

  • 28 May 2019 at 5:41 PM
    Permalink

    Is this supposed to work in BC 14 and above? Because it’s not working in 13.5.29483.0
    We have the problem for last 3 hours, some user locked Item table and we cannot post anything.

    • 29 May 2019 at 8:42 PM
      Permalink

      hi Tin, i tested on r.14 also in production environment.

      I have verified that sometimes it closes the sessions correctly, sometimes not, it depends on the cases.
      for example if you have a session blocked by a report that is running very slow, closing the session unlocks the system (ex; the report Inventory evaluation)

      I have no deadlocked customers on tables on BC today, at most I have 40 connected users, no more currently.
      there are no other ways to kill the sessions that I know of.

  • 16 January 2020 at 6:27 PM
    Permalink

    Hey,

    BC15, can’t delete from the table. I did successfully use the killsession command a few times, but not always. Seems kind of arbitrary as to whether it works. This is the code I added to the “Active Session List Custom” page (the other page is imo entirely useless):

    actions
    {
    area(Processing)
    {
    action(KillSession)
    {
    Caption = ‘Kill Session’;
    Promoted = true;
    PromotedCategory = Process;
    PromotedIsBig = true;
    ApplicationArea = All;

    trigger OnAction()
    begin
    if (not StopSession(Rec.”Session ID”)) then
    Message(‘Failed to stop session %1.’, Rec.”Session ID”);
    end;
    }
    }
    }

    I will say this, MS needs to allow us to kill sessions a lot more easily. They are digging their own grave by having people rely on a ticketing system to do so.

  • 12 July 2022 at 10:54 AM
    Permalink

    Hello

    how to identify the user that lock ledger entry table for exemple.

    Best regeards

Comments are closed.