How to Check Current Session Id in Ax

Description:-

You can retrieve the current client session id by using the following function: SessionId().

So, for example in a job, to show the current session id

static void ClientSessionJob(Args _args)
{
    ;
    info(strfmt('Client Session id-%1',int2str(SessionId())));
}

You can use this function together with the class xSession to collect more info.
The class xSession is responsible for retrieving various session information. Like the logon date and time:

static void LogonDateTime(Args _args)
{
    xSessionxSession;
    ;
    xSession = new xSession(SessionId());
    info(strfmt('logon date and time - %1',DateTimeUtil::toStr(xSession.loginDateTime())));
}

Or the current AOS server name you're logged onto:

static void CurAOSServerName(Args _args)
{
    xSessionxSession;
    ;
    xSession = new xSession();
    info(strfmt('Current AOS server name-%1',xSession.AOSName()));
}

Instantiate the class xSession without a session id to get info for the current session.
The user id used to create the session is also available. But there is an alternative for this one:

static void ClientUserId(Args _args)
{
    ;
    info(strfmt('Current user id-%1',curUserId()));
}

Related Posts

Thanks for comments.....

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer