Dynamics Search Engine

Friday, April 11, 2014

How to fix synchronization error ‘Cannot create a record in Version control changes (SysVersionControlTmpChange)’ with TFS while importing?

How to fix synchronization error ‘Cannot create a record in Version control changes (SysVersionControlTmpChange)’ with TFS while importing?

Applied on: Dynamics AX 2012 R2
Prerequisite: Basic Dynamics AX 2012 programming knowledge & basic knowledge of how to use Team Foundation Server (TFS).
Target audience: AX programmers
Assumption: You are familiar with Dynamics AX 2012, TFS and Visual Studio .Net

 
Symptom:

1)     When you try to synchronize a model with Team Foundation Server (TFS), it throws error like “Cannot create a record in Version control changes (SysVersionControlTmpChange). Change Number: [a numeric number]. The record already exists.”

 
2)     You try to synchronize an object with TFS and system throws errors “Cannot create a record in Version control changes (SysVersionControlTmpChange). Change Number: [a numeric number]. The record already exists.”

 
A sample error.

 
I was facing the above error and came up with a solution as below.

The above screenshot shows a RecID “5637527359”. I searched for this RecID in SysVersionControlSynchronizeLog table record and got the record, noticed that ItemPath field of this searched record shows a value where I can see AOT path for a view called DirPartyPostalAddressView.

Then I searched SysVersionControlSynchronizeLog table for view DirPartyPostalAddressView using ItemPath field as shown below.






It shows two entries (record) for DirPartyPostalAddressView in the searched result. Here system has two entries for DirPartyPostalAddressView so during TFS synchronization it tries to create two entries to table SysVersionControlTmpChange and this table does not allow more than one entry for the same object. During 2nd entry for DirPartyPostalAddressView to SysVersionControlTmpChange, system throws error “The record already exists.”

Now I have the visibility to which object the problem is associated with. So I opened the AOT and went to view DirPartyPostalAddressView, compiled it and synchronized it with TFS. On synchronization it throws same error. Then I started looking to the customization done for this objects and came out with a conclusion that some incorrect customization was there. I fixed it and it was working perfectly.

Hope this piece of information will be useful for you.
You may write your comments below.