Pages

Wednesday, February 11, 2009

Dealing with changed table or field id's

If you apply an application code layer to an application where table or field id's have been changed from what they used to be, you will lose data during the database synchronization process.

To mitigate this I often see that people export the data first and then re-import it after having deployed and synchronized the new layer.

There is however a smarter, and faster, way to mitigate this issue. What you need to do is to change the id's from the old values to the new values in the SQLDictionary kernel table before the synchronization process starts.

You can of course get into all sorts of trouble if you make incorrect changes to SQLDictionary, so use the helper methods on the ReleaseUpdate class to do your dirty work:

  • changeFieldByAOTName
  • changeFieldByName
  • changeFieldId
  • changeNameByFieldId
  • changeTableByAOTName
  • changeTableByName
  • changeTableId

Look for further information in the upgrade white papers:
How to Write Data Upgrade Scripts White Paper for Microsoft Dynamics AX 2009
Writing Upgrade Scripts White Paper for Microsoft Dynamics AX 4.0

No comments: