Inactivity Auto Logout for Dynamics GP - part II

In part one of Inactivity Auto Logout for Dynamics GP, a Dynamics GP add-in was  developed to auto logout on inactivity of the GP client. With GP 2013R2 came some new functionally to message users. That functionally breaks the auto logout.

To read about the user messaging see the post, Check for User Messages(1) Dynamics GP Process Monitor

From that post you learn that there is a new timer in GP that fires approximately every minute. Setting a DEX logging on an idle GP session reveals the following:

15:27:06 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00 
15:27:06 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:27:06 'SQLPath', 0, 7, 0, ""
15:28:21 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:28:21 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:28:21 'SQLPath', 0, 7, 0, ""
15:29:36 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:29:36 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:29:36 'SQLPath', 0, 7, 0, ""
15:30:14 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:30:14 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:30:14 'SQLPath', 0, 7, 0, ""
15:31:29 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:31:29 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:31:29 'SQLPath', 0, 7, 0, ""
15:32:06 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:32:06 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:32:06 'SQLPath', 0, 7, 0, ""
15:33:21 B:'CheckForUserMessages of form sySendMessage', 00/00/0000 00:00:00
15:33:21 B: 'DisplayAndDeleteUserMessage of form sySendMessage'
15:33:21 'SQLPath', 0, 7, 0, ""

For those interested, SQLPath parameters are:  dict_id, table_series, table_group, data_path, where 7 is for System table.

The problem in terms of our idle detection is that one of the events that resets the idle timer is the SQL path function

AddHandler DynamicsGP.Procedures.SqlPath.InvokeAfterOriginal, 
AddressOf oGlobalProcedures.DynamicsProceduresSqlPathInvokeAfterOriginal

hence GP 2013R2 is never idle due to this timer using the SQLPath function every minute.

After exchanging emails with David Brown at Rock Solid he solved the problem with the following code. He sets a flag and resets it to detect if the SQLPath execution is from the timer event or user activity. Here is his solution:

Public Sub DisplayAndDeleteUserMessageProcedureInvokeAfterOriginal(sender As Object, _
e As Applications.DynamicsDictionary.SySendMessageForm.DisplayAndDeleteUserMessageProcedure.InvokeEventArgs)
Try
checkUserMessagesEventFired = True
Catch ex As Exception
'Throw New RSTAppException(Me.GetType.Name, GetCurrentMethod.Name, ex, , False)
End Try
End Sub

Public Sub DynamicsProceduresSqlPathInvokeAfterOriginal(sender As Object, _
e As Applications.DynamicsDictionary.SqlPathProcedure.InvokeEventArgs)
Try
If Not checkUserMessagesEventFired Then
oInactivityTimer.Tick()
End If
checkUserMessagesEventFired = False
Catch ex As Exception
'Throw New RSTAppException(Me.GetType.Name, GetCurrentMethod.Name, ex, , False)
End Try
End Sub

Hence we again have the ability to implement the auto logout function, thanks David!

Comments (1) -

  • If you are using Wennsoft Equipment manager, the same applies for
    Procedures.EqsProcessOnOffRentals.InvokeAfterOriginal

Pingbacks and trackbacks (1)+

Add comment

Loading