Monday 15 October 2012

Dynamics AX Database Synchronization Issue

Problem Description:

Many time, when while one tries to sync the Dynamics AX Database, or Imports an XPO, an error may appear related to Object Id's. e.g. 
Example #1:
Illegal data conversion from orignal field DEL_EMPLTABLE.PSACALENDERIDMAXHOURS to DEL_EMPLTABLE.RBOEmploymentType: Unable to convert data types to anything but character field type(0 to 4)
Example #2.
Table HCMWorker Aalready Exists.




























  

Reason of the Problem: 

The old/previous definition of the table, still exists on SQL Server Level, even that may not be visible to you on Dynamics Ax Level, But in fact that have still existence on SQL Server Level. So, when the system tries to update the table/field, the system finds the table/field with same TableId/FieldId already available. This is the main reason to problem.

 

Solution to the Problem:

 

There are two solutions to this kind of problem, as under:


Solution#1: (Using X++ Code)

In this solution we write X++ Code that resolves the problem. If we see at the problem, once more. the problem is all about Table Id or Field Id, So what we need to do we need to update Table Id or Field Id, depending upon the error message. 

If you get the error message as shown in the above image, use the code as under to update field Id.

ReleaseUpdate::chageFieldId(tableId, Old FieldId, New FieldId, tableName, Old FieldName);  
ReleaseUpdateDB::changeFieldId(123, 80001, 80030, "EmplTable","PSACALENDERIDMAXHOURS");

If you get the error message like "Table "Table Name" Already Exists" , use the code as under
ReleaseUpdateDB::chageTableId(TableId, New TableId, "TabelName");
ReleaseUpdateDB::chageTableId(81110, 81112, "EmplTable" );

Go to Dynamics AX, AND Synch the Database.


Solution#2: (Without Code)

Simply Open Microsoft SQL Server.
Open Dynamics AX Database.
Go to the table that is creating problem. Right Click it and Press Delete. 

Go to Dynamics AX, AND Synch the Database.

 




 

No comments:

Post a Comment