Home » Listing Details
Top Websites
  1. Dynamics GP Help
    Over 5900 resources listed.
  2. Mark Polino's DynamicAccounting.net
    Over 5100 resources listed.
  3. Rose Business Solutions Blog New
    Over 2200 resources listed.
  4. Developing for Dynamics GP - By David Musgrave and the MS GP Dev Support Team
    Over 1100 resources listed.
  5. Mariano Gomez at The Dynamics GP Blogster
    Over 900 resources listed.
  6. Microsoft Dynamics Partner Community Blog
    Over 900 resources listed.
  7. Christina Phillips, Steve Endow & Lorren Zemke at Dynamics GP Land
    Over 700 resources listed.
  8. Mohammad Daoud's Dynamics GP Blog
    Over 600 resources listed.
  9. Vaidy Mohan at Dynamics GP - Learn & Discuss
    Over 500 resources listed.
  10. Inside Microsoft Dynamics GP Official Blog
    Over 500 resources listed.
  11. eOne Business Solutions Blog
    Over 400 resources listed.
  12. About Dynamics, Development and Life
    Over 300 resources listed.
  13. Frank Hamelly at GP2theMax
    Over 300 resources listed.
  14. Dynamics CPM
    Over 300 resources listed.
  15. BKD Dynamics GP Insights Blog
    Over 200 resources listed.
  16. Leslie Vail at Dynamics Confessor Blogspot
    Over 200 resources listed.
  17. Victoria Yudin's Dynamics GP Website
    Over 200 resources listed.
    Victoria Yudin
  18. Janakiram M.P. at DynamicsBlogger
    Over 100 resources listed.
  19. VS Tools Forum
    Over 100 resources listed.
    Your Resource for Visual Studio Tools for Dynamics GP
  20. Inside Microsoft Dynamics GP Official Blog
    Over 100 resources listed.
  21. US Dynamics GP Field Team Blog
    Over 100 resources listed.
  22. Catherine Eibner MBS Developer Evangelist
    Over 100 resources listed.
  23. Sivakumar Venkataraman at Interesting Findings & Knowledge Sharing
    Over 100 resources listed.
  24. Dynamics Small Business
    Over 100 resources listed.
  25. Belinda, The GP CSI
    Over 100 resources listed.

ID:9625
Title:GPtip42day - Track User Inactivity
URL:http://gp2themax.blogspot.com/2010/02/gptip42day-track-user-inactivity.html
Description:

I generally don't get into the technical side of GP in the Tip42day but this is just too good not to share. 

A user on the https://community.dynamics.com/forums/32.aspx forum posed the following question -

Is there any column that will show the last activity time for a user? I would like to be able to send email alerts to users who are logged in but haven't been active for 1 hour.

This is a great idea but I'm not aware of any field in any table in GP that stores this info.  However, I didn't think about pulling this directly from SQL.  Fortunately, there are people much smarter than I am out there who did.  Here's the solution - 

SELECT CASE WHEN S.session_id IS NULL THEN 'Missing DEX_SESSION'


ELSE ''


END MISSING_SESSION,


CASE WHEN DATEDIFF(mi, P.last_batch, GETDATE()) > 1


THEN 'Idle for ' + LTRIM(RTRIM(STR(DATEDIFF(mi, P.last_batch, GETDATE())))) + ' minutes.'


ELSE ''


END AS IDLE_TIME_DESC,


CASE WHEN DATEDIFF(mi, P.last_batch, GETDATE()) > 1


THEN DATEDIFF(mi, P.last_batch, GETDATE())


ELSE 0


END AS IDLE_TIME,


A.USERID,


A.CMPNYNAM COMPANY_NAME,


INTERID COMPANY_ID,


LOGINDAT + LOGINTIM LOGIN_DATE_TIME,


SQLSESID SQL_SESSIONID,


P.login_time SQL_LOGINTIME,


P.last_batch SQL_LAST_BATCH,


DATEDIFF(mi, P.last_batch, GETDATE()) TIME_SINCE_LAST_ACTION,


S.session_id SQLSERVER_SESSIONID,


S.sqlsvr_spid SQLSERVER_PROCESSID,


P.spid PROCESSID,


P.status PROCESS_STATUS,


P.net_address NET_ADDRESS,


P.dbid DATABASE_ID,


P.hostname HOSTNAME


FROM DYNAMICS..ACTIVITY A


LEFT JOIN DYNAMICS..SY01400 U ON A.USERID = U.USERID


LEFT JOIN DYNAMICS..SY01500 C ON A.CMPNYNAM = C.CMPNYNAM


LEFT JOIN tempdb..DEX_SESSION S ON A.SQLSESID = S.session_id


LEFT JOIN master..sysprocesses P ON S.sqlsvr_spid = P.spid


AND ecid = 0


LEFT JOIN master..sysdatabases D ON P.dbid = D.dbid

This script creates a column called 'IDLE_TIME' and stores the idle time in minutes, which can be used to determine which users to send the email to via SQL Mail.

Thanks to Ron Wilson and Sivakumar Venkataraman for this great tip!

Category:SECURITY IN GP
Link Owner:
Date Added:June 17, 2010 05:08:11 AM
Number Hits:23
RatingsAverage rating: (0 votes)
Reviews

No Reviews Yet.

 
GPWindow.com

Thank you for your support for GPWindow. It helps us cover part of the hosting costs for GPWindow.