With sites using Microsoft Dynamics GP over Citrix Presentation or XenApp, where they have set Citrix to time users out after a certain period of inactivity, we occasionally see the following error message when another user tries to open the voucher in Payables Transaction Entry ( );
The problem occurs when a user has a transaction open in Payables Transaction Entry and doesn’t touch GP for a while, such as when they go to lunch or even home for the evening. We have repeatedly stressed to clients that they should close GP down when they leave their desk for a period of time, if only for security purposes along with locking their machine, but this is a battle we seem destined to lose.
If the user, who was locking the transaction, logs back into GP then the lock is automatically removed. But if the user doesn’t log back in before someone else tries to open the invoice they get the above error ad we get a call logged on the helpdesk.
The following SQL is what we have produced to quickly remove the lock entries from ACTIVITY in the system database and DEX_LOCK and DEX_SESSION in tempdb, change the value of the (highlighted) @VCHRNMBR variable to your Voucher Number;
SELECT * FROM tempdb..DEX_LOCK
SELECT * FROM tempdb..DEX_SESSION
SELECT * FROM DYNAMICS..ACTIVITY
DECLARE @Session_ID INT
DECLARE @VCHRNMBR VARCHAR(30)
SET @VCHRNMBR = '00000000000000460'
SET @Session_ID = (
session_id FROM tempdb..DEX_LOCK AS DEX_LOCK (*)
PM10000 AS ['PM Transaction WORK File'] (*)
ON ['PM Transaction WORK File'].DEX_ROW_ID = DEX_LOCK.row_id
['PM Transaction WORK File'].VCHRNMBR = @VCHRNMBR
IF @Session_ID IS NOT NULL
DELETE FROM tempdb..DEX_LOCK WHERE session_id = @Session_ID
IF (SELECT COUNT(*) FROM tempdb..DEX_SESSION AS DEX_SESSION (*) WHERE DEX_SESSION.session_id = @Session_ID) > 0
DELETE FROM tempdb..DEX_SESSION WHERE session_id = @Session_ID
IF (SELECT COUNT(*) FROM dynamics..ACTIVITY AS ACTIVITY (*) WHERE ACTIVITY.SQLSESID = @Session_ID) = 0
DELETE FROM DYNAMICS..ACTIVITY WHERE SQLSESID = @Session_ID
As always with scripts be careful when running them; especially in this case make sure the user who is being removed really is not in the system. Once or twice when this was being logged, the user was still actively working on the voucher in question.