Wednesday, July 24, 2013

AX2012 R2 : Synchronize Table – Failed to create a session

Hi All

Today during a DB Sync compare at the end the follow error:

Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics

The code in error was on class SysSetupInstaller Method loadAllData on RunAs command.

After some investigation, I have found on Table USERINFO two records with ADMIN ID ( I have two Partitions ) where the first one had a wrong SID !
After update with the right SID, the Sync process finished with success.

See also AX2012 R2 : DB Sync – Failed to create a session

Enjoy !

Tuesday, July 23, 2013

AX 2012 - There is already a listener on IP endpoint


I have a Server with 3 AOS Services with AX 2012 CU 1.

Today i have install CU 6 !

After that, all AOS Services except the first, give me an error during startup :

Object Server 02: System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP endpoint Make sure that you are not ......

I have verify that the files Ax32Serv.exe.config have been modified from the CU 6 setup.
In details, the Service Port and Wsdl Port had the same values as the first AOS Service !

I have modify the Config file with the right values on Service Port and Wsdl Port in all places.

After that, all work fine !

Enjoy !

Thursday, July 18, 2013

Update AX User SID


When you move an AX Database from different domain, is necessary to update the AD User SID.
Below a nice job.

Enjoy !

static void UpdateSID(Args _args)
    UserInfo                UserInfo;
    AxaptaUserManager       aUserManager = new AxaptaUserManager();
    DomainName              networkDomain;
    Sid                     sid;
    networkDomain = (select networkDomain from UserInfo
                      where == curUserId()).networkDomain;
    while select forUpdate UserInfo
        where  UserInfo.networkAlias
            && != "Guest"
            sid = aUserManager.getUserSid(UserInfo.networkAlias, networkDomain);
            if( !sid )
                warning(strFmt("Utente %1 non presente in active directory, domain %2",, networkDomain));
            UserInfo.networkDomain  = networkDomain;
            UserInfo.sid            = sid;
            warning(strFmt("Impossibile modificare l'utente %1",;


Monday, July 8, 2013

How can I get list of tables in a table collection ?

    SysDictTableCollection  tableCollection;
    SysDictTable            SysDictTable;

    TableName               tableName;
    Str                             sqlTableName;
    tableCollection = new SysDictTableCollection("TableCollationName");
    tableName       = tableCollection.nextTable();
    while (tableName)
        SysDictTable = New SysDictTable(tablename2id(tableName));
        sqlTableName = DbBackend::Sql );
        If ( ! sqlTableName)
        Info ( tableName + " - " + sqlTableName );
        tableName = tableCollection.nextTable();

Enjoy !