Monday, 1 December 2014

AX 2012 Job to kill users/sessions

Static Killusers(Args _args)
{
      SysUsersTerminate usersTerminate;
      SysClientSessions sysUserSession;
      UserInfo userInfoTable;
      container usersList;
      ;   

         while select sysUserSession
         where sysUserSession.userId != curUserId()
          { 
           usersList +=   [[sysUserSession.userId,sysUserSession.SessionId,sysUserSession.LoginDateTime]];
          }
        usersTerminate = SysUsersTerminate::newUsersList(usersList);
        if (usersTerminate.prompt())
         usersTerminate.run();

      pause;
}

No comments:

Post a Comment

Calculate ledger balance by dimension set in X++ in AX2012/Dynamics 365 FO

There are a variety of ways users can view balances in the general ledger. Some of the most common options are: 1. Trial balance 2. Financia...