Hey guys,
has anyone of you ever managed to subscribe successfully to the "OnAfterInsertEvent" of Table "Session Event"?
I'm doing this:
[EventSubscriber(ObjectType::Table, Database::"Session Event", 'OnAfterInsertEvent', '', false, false)]
local procedure User_Session_Event_Inserted_Handler(var Rec: Record "Session Event")
begin
if Rec."Client Type" <> Rec."Client Type"::"Web Client" then
exit;
// Do some stuff here when a User logged in via Modern Client
end;
But neither my breakpoints are hit inside that handler nor my debugging textfile gets written. Am a bit confused now.
Regards
Markus
0
Answers
Yes it is, running in a dev container, build from BC container helper.
I also fiddled a bit around with
- table 2000000110 "Active Session" > OnAfterInsertEvent: Seems to works neither
- codeunit 40 LogInManagement > OnAfterLogInEnd: Seems to be deprecated
- codeunit 150 "System Initialization" > OnAfterLogin: No information about the user
Could it be that some of the session related stuff is done in "a deeper layer" somehow between SQL and BC server and not in that place where other events get fired?
I want to log a users last logon and logoff timestamps in my app for example.
You're not going to get anywhere (good) trying to subsribe directly to a system table.
As an alternative, you can use Codeunit 40 LogInManagement's event OnAfterCompanyOpen to get login events.