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.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 77,925 Super User 2025 Season 1 on at
    Session kill publisher (AL)
    I haven't noticed this either, thanks for sharing, I will test it when I have time.
  • ibogovic Profile Picture
    ibogovic 55 on at
    Session kill publisher (AL)
    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.
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 77,925 Super User 2025 Season 1 on at
    Session kill publisher (AL)
    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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans