function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcbynitesfdcbynite 

triggering action on logout - client or server side

When our users log into SFDC they are sent to a "Time Card" page to "punch in." Ideally they are supposed to "punch out" before logging out, but of course they sometimes forget.

What we would like is for them to be reminded or redirected to the time card when trying to log out (or closing the tab/browser). I thought to try this via javascript with the beforeunload event but that triggers the event every time they change pages and it seems that you can\t capture a window close event. So does anyone have an idea how to do this?

Another acceptable solution would be server-side to automatically record into the time card when the session ends. Is there any way to trigger an event on logout/end of session?

Thanks,
Dovid