Ax2012 Duplicate key was found for the object name 'dbo.TableName'
Problem :-
This message we can get at the time of Tables synchronization which is won't allow you any full synchronization of the application.
Soluction: -
The message says: "The duplicate key value is presented in the table". Note that this always reports the first error only and there may be more of them.
Go to AOT and find the table where we are getting this error. Now go to the Indexes of the table and right-click the index choose Add-Ins > Duplicates
All the duplicate values will be their in a info box with the number of records. You have to match the value with Filed which is presented in Index and remove all the other field which have same value.
I don't know how AX maintain any table, therefore I wouldn't recommend deleting all the data unless you prove it's safe or related table data is safe.