#GPPT Why does Automatic Logout fail to work?

David Meego - Click for blog homepageBuild 26 of GP Power Tools introduced a new Automatic Logout feature for Microsoft Dynamics GP. This functionality was further enhanced in later builds.

While there are other solutions which can log out inactive users, the implementation in GP Power Tools has many enhancements and features not available in other offerings.

However, there are also times when Automatic Logout has been reported not to work. Read on to understand what is happening….

We should start by explaining how the feature works so you can see what it offers in comparison to other third party solutions.

Note: The screenshots in this article have been updated to the Build 29 release of GP Power Tools and include features not available in the earlier builds.

How Automatic Logout works

The Automatic Logout feature is configured from the License Tab of the Administrator Settings window in the User Activity Settings section:

It is not actually possible to track inactivity in Microsoft Dynamics GP, so instead we track activity by keeping a last activity date and time which is updated by a number of common activities in Dynamics GP.

Automatic Logout is enabled to take effect after a specified number of minutes (default is 60 minutes) and will take effect for all users and companies. However, by clicking the User Selection button it is possible to include or exclude on a per user and/or company basis. Build 28 also allows inclusion based on User Class, Security Modified Alternate ID, Security Roles and Security Tasks.

There is also an option to get more aggressive with the logout time if your available user count gets below a specified percentage (default is 10% and 30 minutes).

Using a timed background process which is executed every minute, we can check when the last activity was and take further action when needed. You can view this process by selecting Microsoft Dynamics GP >> Process Monitor from the menus and changing to the Timed queue.

Once the minutes from the last activity record reaches one minute less than the limit, a dialog will open and count down the last minute.

The dialog can be disabled for all or for selected users. This can be handy if users are always cancelling the dialog to stop the Automatic Logout. If they were actually using Dynamics GP the dialog would never appear. If User Activity Tracking has been enabled, you will also be able to see how many times a user has cancelled the dialog using the User Activity Log window; look at the Auto Dialog column.

The dialog will attempt to bring itself to the front of any open windows and will cause the Dynamics GP icon on the start bar to flash (there is an option to disable this behaviour if desired).

Once the final minute has counted down (or the Exit Now button is clicked), GP Power Tools will start the Automatic Logout.

What Automatic Logout does

Depending on the options selected on the Administrator Settings window, once the Automatic Logout starts the following actions will occur:

  • Any open windows will be closed (in the reverse order of how they were opened).
  • If the window has unsaved data and has a Save button or OK button and all required fields have been entered, the button will be clicked before attempting to close the window.
  • If the window is an Inquiry window it will be cleared and closed. (New to Build 28).
  • The record in the ACTIVITY table for the session will be removed to free up the user license. (New to Build 28).
  • Finally, a close window command is issued to close any remaining windows missed by the steps above.

If all the windows are closed, GP Power Tools will issue an Exit After Processes instruction. This is a GP Power Tools feature which will allow any background processes to complete before exiting.

Build 29’s Exit After Processes code will check if any other processes are waiting and reschedule itself after those processes if any exist. This ensures that it is always the very last action left in the background processing queue.

Note that the exit is ALWAYS a graceful exit and it will never interrupt background processes, leave orphaned records or cause data corruption.

On the rare occasion that there is a window with data which needs saving, but does not have all the required fields or has another issue which opens a modal system dialog, the exit will fail to complete.

If User Activity Tracking is enabled, the Auto Count, Auto Date and Auto Time columns will show how many times the Automatic Logout has started and the date and time of the last attempt. The Auto Exit column will show how many times the Automatic Logout succeeded. If you have a high count value with a low exit value, then you might find the user is actively doing something to prevent Automatic Logout from working. This is why the new features were added in Builds 28 and 29

Why does Automatic Logout fail to work?

Let me now explain why Automatic Logout might fail to work on a system. This article is the result of a couple of recent support cases.

Please review the following steps if you believe that Automatic Logout is not working:

  1. Make sure GP Power Tools is installed on ALL workstations and servers. GP Power Tools should be installed everywhere the Dynamics GP application is installed. How can the code work if it is not installed? This is a requirement for almost all features of GP Power Tools.
  2. Make sure GP Power Tools is registered for Administrator Tools and log back in. It needs to be registered at login for the functionality to activate.
  3. Look at the Timed Queue in the Process Monitor to confirm that the background process is there. If not, the feature is not enabled or the user is exempted.
  4. Make sure the Check for SQL activity option on Administrator Settings window is NOT selected. This option can prevent a logout if another background process reads or writes to the SQL Server.
  5. Test to see if any of the other processes in the Timed queue of the Process Monitor window reset the last activity time. Make a note of the Last Activity minutes shown on the Auto Logout process. For each of the other processes in turn, select it and click the Run Now button, then select Auto Logout and click Run Now and see if the Last Activity resets back to 0. If it does reset back to 0, please open a support request so we can investigate which product is causing the issue.
  6. If running on a Terminal Server (or Citrix Server) and you are using a timeout feature on the server, make sure that the Automatic Logout time set for GP Power Tools is less than the timeout feature by at least 30-60 minutes. If the Terminal Server kills the Dynamics GP process, not only will the Automatic Logout not be able to work, but you risk serious data corruption.
  7. If running on a workstation which is set to Sleep or Hibernate before GP Power Tools is able to log out, the session will be “in stasis” until the machine is active again. Note: A machine that goes into a sleep or hibernate state will probably disconnect the SQL connection and can cause issues with temporary tables when a new SQL SPID is assigned.
  8. If a session cannot be exited gracefully because a dialog requiring user interaction has been displayed when attempting to close all windows, the system will not exit.
  9. The Date Change Dialog which shows at midnight (by default) can prevent exiting as it can hold up the background queue. There is now an option in Automatic Logout to automatically handle this dialog and prevent it opening.
  10. If background processing has been paused (manually, or due to a report waiting to process while the previous report is still being displayed to screen), the background process used to check if Automatic Logout should be activated will be waiting in the queue.
  11. GP Power Tools – Developer Tools module uses background timed processes for Time and Scheduled Triggers. These can reset the last activity date and time and prevent Automatic Logout from working. Changes have been made in build 30.2 or later to avoid this issue as long as the background processes do not open a window.
  12. The new options (see screenshot below) to automatically close the Login and Switch Company windows and also close the Report Writer Screen Output windows should be left enabled to ensure they do not hold up background processing.

See this article that explains why the Report Writer Screen Output window timeout is important:

See this article which explains why users might be logged out even though they are still using Microsoft Dynamics GP:

The two support cases raised were resolved by point 1 and point 5 in the list above.

More Information

For more information see:

I hope this information was helpful.

David

21-May-2020: Added seventh reason, for Automatic Logout to fail due to not being able to close all windows.
23-May-2020: Added eighth reason, for the background process queue is held up, preventing the Automatic Logout check from running.
16-Apr-2021: Added additional reason, to ensure that the Administrator Tools is registered at login.
16-Sep-2022: Updated for Build 29 features.
20-Jan-2023: Added link to article about Report Writer Screen Output window.
23-Jan-2023: Added article explaining how to handle when Automatic Logout does not detect activity.
12-Jan-2024: Added article with Immediate Automatic Logout sample.
07-Feb-2024: Added notes on background processes and workstations sleeping or hibernating.

This article was originally posted on http://www.winthropdc.com/blog.