Options

Forced Navision Logoff for Inactivity

slowhandfanslowhandfan Member Posts: 56
I have customer who purchased 20 seats running Navision 4.0 SP2

In the stores, receiving personnel are using WINDOWS LOGINS
At the home office, the users use DATABASE LOGINS

The issue is this.. 20 seats is plenty for concurrent access

However, certain job functions in the stores and home office, have people logging onto Navision, working for 5 minutes, and then doing nothing for 5 hours. This effectively takes up 1 seat uselessly..

What he wants is a way to log people off NAVISION if they have done anything for 15 minutes.

He knows how to do this in WINDOWS, but that will not free up the Navision Seat.

DOES ANYONE KNOW A WAY TO ACCOMPLISH THIS.

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    install NAS.

    Create a single instance codeunit with timer and let it monitor the session table and delete records (Users) if they are inactive after a certain time.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    themavethemave Member Posts: 1,058
    I also did it with a processing only report on the session table and run it in the job scheduler
  • Options
    slmaluwaslmaluwa Member Posts: 358
    themave

    I didn't understand the answer. Did it solved the problem?
    I am also desperately looking for a solution for this.

    Currently, I keep one user LOGGED ON forever on the server, in case if we need to login to remove inactive users forcibly.


    Maluwa
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • Options
    kinekine Member Posts: 12,562
    We are selling to our customers module for that. It is easy to create such a functionality, which will go through Session table and disconnect any inactive user. You can add some setup (inactivity time, skip some users etc.) and you can run it under NAS.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    themavethemave Member Posts: 1,058
    slmaluwa wrote:
    themave

    I didn't understand the answer. Did it solved the problem?
    I am also desperately looking for a solution for this.

    Currently, I keep one user LOGGED ON forever on the server, in case if we need to login to remove inactive users forcibly.


    Maluwa
    Yes, it is a processing only report,

    dataitem session table

    filter Idle Time > 15 minuts

    this makes it only look at idle sessions,

    then in the onaftergetrecord

    I have the command

    Delete

    that is it

    run it in the job scheduler, so it runs on a regular bases and disconnects idle sessions.
  • Options
    slowhandfanslowhandfan Member Posts: 56
    Does this work if they are running native, or only if the are running under SQL?
  • Options
    ara3nara3n Member Posts: 9,255
    Hello here is an example of single instance CU for SQL.
    OBJECT Codeunit 50025 NAS session monitor
    {
      OBJECT-PROPERTIES
      {
        Date=10/21/07;
        Time=[ 8:03:01 PM];
        Modified=Yes;
        Version List=Mibuso,ara3n;
      }
      PROPERTIES
      {
        SingleInstance=Yes;
        OnRun=BEGIN
                IF ISCLEAR(Timer) THEN
                  CREATE(Timer);
    
                Timer.StartTimer(6000);
    
                Db.SETRANGE("My Database",TRUE);
                Db.FINDFIRST;
              END;
    
      }
      CODE
      {
        VAR
          Timer@1004 : Automation "{DDADD7CC-AD56-4CA6-9C85-22AE76BF21A1} 3.0:{E7414D60-2D83-44C7-826A-FD14557299F0}:'CP Timer'.cTimer" WITHEVENTS;
          Session@1000000000 : Record 2000000009;
          Db@1000000001 : Record 2000000048;
    
        EVENT Timer@1004::TimerEvent@1();
        BEGIN
          Session.SETRANGE("Database Name",Db."Database Name");
          Session.SETRANGE("My Session",FALSE);
          Session.SETFILTER("Idle Time",'>15 min');
          IF Session.FINDSET THEN REPEAT
            Session.DELETE;
            COMMIT;
          UNTIL Session.NEXT = 0;
        END;
    
        BEGIN
        END.
      }
    }
    



    Here is an example for Native 4.x version and up.
    OBJECT Codeunit 50025 NAS session monitor
    {
      OBJECT-PROPERTIES
      {
        Date=10/21/07;
        Time=[ 8:15:10 PM];
        Modified=Yes;
        Version List=Mibuso,ara3n;
      }
      PROPERTIES
      {
        SingleInstance=Yes;
        OnRun=BEGIN
                IF ISCLEAR(Timer) THEN
                  CREATE(Timer);
    
                Timer.StartTimer(6000);
              END;
    
      }
      CODE
      {
        VAR
          Timer@1004 : Automation "{DDADD7CC-AD56-4CA6-9C85-22AE76BF21A1} 3.0:{E7414D60-2D83-44C7-826A-FD14557299F0}:'CP Timer'.cTimer" WITHEVENTS;
          Session@1000000000 : Record 2000000009;
    
        EVENT Timer@1004::TimerEvent@1();
        BEGIN
          Session.SETRANGE("My Session",FALSE);
          Session.SETFILTER("Idle Time",'>15 min');
          IF Session.FINDSET THEN REPEAT
            Session.DELETE;
            COMMIT;
          UNTIL Session.NEXT = 0;
        END;
    
        BEGIN
        END.
      }
    }
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    ara3nara3n Member Posts: 9,255
    To run this from NAS, you need to install NAS.
    Modify CU 1 function

    NASHandler

    Add the following code.
      IF CGNASStartedinLoop = FALSE THEN
        CASE Parameter OF
          'OSYNCH','JOBQUEUE':
            BEGIN
              IF NOT JobQueueSetup.GET THEN BEGIN
                JobQueueSetup.INIT;
                JobQueueSetup.INSERT;
              END;
              IF NOT JobQueueSetup."Job Queue Active" THEN BEGIN
                JobQueueSetup.VALIDATE("Job Queue Active",TRUE);
                JobQueueSetup.MODIFY;
              END;
              CODEUNIT.RUN(CODEUNIT::"Job Queue Dispacher");
            END;
          //Start Mod
          'SESSIONMONITOR':
            BEGIN
              CODEUNIT.RUN(CODEUNIT::"NAS session monitor");
            END;
          //End Mod
        END;
    


    Start NAS with startup Parameter SESSIONMONITOR
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    themavethemave Member Posts: 1,058
    Does this work if they are running native, or only if the are running under SQL?
    it works in navtive, the session table is a navision table, Mine is running on a navtive database
  • Options
    kinekine Member Posts: 12,562
    Does this work if they are running native, or only if the are running under SQL?

    You can use it in Native if you are using NAV 4.00 and newer. Just in this versions you can disconnect users by deleting their session and you have the Idle Time field there...

    And on SQL you can use it on older versions too, but you need to add the Idle Time into the session view and NAV able or create own session view based on the 4.00 version.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.