Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

(0) ShareShare
ReportReport
Posted on by 1,771

Hi,

We need to remove the login access in GP, if user does not use GP for 10 minutes.  Is ther nay way we can do this.  Kindly help me .... with details ..

Regards,

Noushad

*This post is locked for comments

  • Suggested answer
    Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    RE: Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

    Use at your own risk:

    DECLARE @tTable TABLE (sqlsvr_spid INT);
    
    INSERT @tTable
    SELECT
    	S.sqlsvr_spid
    FROM DYN18..ACTIVITY A
      LEFT JOIN DYN18..SY01400 U on A.USERID = U.USERID
      LEFT JOIN DYN18..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
    WHERE datediff ( mi, P.last_batch, getdate() ) >= 30;
    
    DELETE A
    FROM DYN18..ACTIVITY A INNER JOIN 
    (
    SELECT
      CASE
        WHEN S.session_id is null
          THEN 'Missing DEX_SESSION'
        WHEN A.USERID <> P.loginame or P.loginame is null
          THEN 'Phantom'
      ELSE ''
      END MismatchOnUserID,
      CASE
        WHEN datediff ( mi, P.last_batch, getdate() ) > 90
          THEN 'Idle ' + str (  datediff ( mi, P.last_batch, getdate() ) )
        ELSE '' 
      END AS Working
      , A.USERID
      , A.CMPNYNAM
      , INTERID
      , LOGINDAT + LOGINTIM LoginDatestamp
      , SQLSESID
      , P.login_time
      , P.last_batch
      , datediff ( mi, P.last_batch, getdate() ) SinceLastAction
      , S.session_id
      , S.sqlsvr_spid
      , P.spid
      , P.status
      , P.net_address
      , P.dbid
      , P.hostname
      , P.loginame
    FROM DYN18..ACTIVITY A
      LEFT JOIN DYN18..SY01400 U on A.USERID = U.USERID
      LEFT JOIN DYN18..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
    ) SQL_ACTIVITY ON (A.USERID = SQL_ACTIVITY.USERID)
    WHERE SQL_ACTIVITY.SinceLastAction >= 30
    
    DELETE FROM tempdb..DEX_SESSION WHERE sqlsvr_spid IN (SELECT sqlsvr_spid from @tTable)
    


    You can schedule a SQL job to run this script, or you can preferably create a stored procedure with it and schedule a SQL job to run the stored procedure, rather. Please at least test it in a test environment, before deploying into production.

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

    There is no native way to do this safely without a 3rd party product.

    Tim.

  • P NOUSHAD Profile Picture
    P NOUSHAD 1,771 on at
    RE: Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

    Hi All,

    Thanks for your reply.  I will make it clear my requirement.  if the user kept GP idle (without any activity) for 30 minutes, there should be some automation to remove his GP user access from GP or logout automatically from GP.  So other user can use his access.  This is the objective of this requirement.

    Kindly help me.  Is there any way we can achieve this requirement other than using 3rd party product.

    Regards,

    Noushad

  • MichaelTsai Profile Picture
    MichaelTsai 75 on at
    RE: Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

    I use the GP Toolbox, works well.   I tested the feature and other features in GP Toolbox, no issues.  I do not use this specific log off feature.  Rockton support are superb also

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: Is there anyway ..... If user is not using GP for 10 minuets, his/her access should be removed

    Do you mean log the user out rather than deactivating the account?

    If this is the case then Rockton have a tool in the toolbox product for this:

    www.rocktonsoftware.com/.../dynamics-gp-toolbox

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans