web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Session kill publisher (AL)

(1) ShareShare
ReportReport
Posted on by 55
Hi guys,
 
is there any publisher which is triggered before session is killed in business central?
 
For example, if we call this line of code:
 
Is there any publisher which will be triggered before user is actually logged off (before session is actually killed)? 
We have some browser cookies which we would like to erase before session kill, but are not sure if there is any publisher we can subscribe to in order to do this.
 
Thank you.
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,548 Super User 2025 Season 2 on at
    Hi, As far as I know, there is an OnAfterLogin event in BC, but there is no Logout related event. This may not be possible, hopefully other experts can give you better advice.
    For example,
     
    Hope this helps.
    Thanks.
    ZHU
  • ibogovic Profile Picture
    55 on at
    Hi @Yun Zhu
     
    This actually helped me (thank you very much). There is actually "OnBeforeLogInEnd" event in the "LogInManagement" codeunit which is triggered on the user log off (from what I tested). Not really sure why this is not called "OnBeforeLogOff" or something like that, because, from the current event name, I would initially guess that this event is triggered just before LOG-IN process is done and therefore would just ignore it.... But I saw that event is called in the "LogInEnd" procedure and inside of that procedure, "LogOutDate" and "LogOutTime" variables are mentioned:
     
    I will try to achieve my initial ideas with deletion of the cookies on the user log-off and will let you know if I managed to do that.
     
    Thank you.
  • Suggested answer
    YUN ZHU Profile Picture
    95,548 Super User 2025 Season 2 on at
    I haven't noticed this either, thanks for sharing, I will test it when I have time.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans