Monday, 18 April 2016

How to get Server and Data Base Name through X++ Code in Ax 2012

static void Raj_Server_DataBaseName(Args _args)
{
    str               database,servername;

    database        =   SysSQLSystemInfo::construct().getloginDatabase();
    servername   =   SysSQLSystemInfo::construct().getLoginServer();

    info(strFmt("ServerName - %1  Data Base -- %2",servername,database));

}

 For DomainName and Username

static void Raj_DomainNameUserName(Args _args)
{
    InteropPermission   permission;
    str                 userName;
    str                 userDomain;
    ;
    permission = new InteropPermission(InteropKind::ClrInterop);
    permission.assert();
    userDomain  = System.Environment::get_UserDomainName();
    userName    = System.Environment::get_UserName();
    info(strFmt(@"%1\%2", userDomain, userName));
}

No comments:

Post a Comment