How to Get AOS Server Name of Current Session using X++ in Ax



Description:-

The following code obtains the AOS server name for the current session. Create Job and run.

Code:-

Static void getServerNameForCurrentSession(Args _args) 
{ 
    sysClientSessions cliSessions; 
    sysServerSessions svrSessions; 
    ; 
    select svrSessions
      existsjoin cliSessions
      where cliSessions.SessionId == sessionID() 
            &&cliSessions.ServerID == svrSessions.ServerId; 
    info(substr(svrSessions.AOSId, 1, strfind(svrSessions.AOSId, '@', 1, strlen(svrSessions.AOSId))-1)); 
 }

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

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

Related Posts

Previous
Next Post »

Thanks for comments.....