Challenge/Problem: Synchronise Dynamics AX database from X++
Description: Previously I have written code to manipulate AX AOT objects via code (reflection) and found the need to kick off a database sync automatically from X++ code. I found the code snippets below to be useful for this operation.
The following two options allow you to perform the db syncronisation.
1. To synchronize a specific table: appl.dbSynchronize([tableid]);
2. To synchronize the whole app: appl.dbSynchronize(0);
2 thoughts on “Synchronize Dynamics AX DB in X++”
I used this API mainly in AX 4.0 to be able to detect on which table DB synchronization failed (see http://dax-cz.blogspot.cz/2010/05/synchronizace-databaze-v-ax-4.html for the script). Nevertheless this particular problem isn’t very common anymore, thanks to the synchronization dialog.