[AX2012 UTILS] It's all about scripting ... Data Dictionary Synchronize


 Today's dilemma: running the Data Dictionary SYNC task using the start-up command in AX.

 The code is coming from a greater script:

 $params = "`"" + $AXCONFIGPATH_DEFINE + "`" -lazyclassloading -lazytableloading -minimize -model=" + ($MODELTOBUILD_DEFINE)

 Write-Host "Synchronizing database; started: " $date
 $date = Get-Date

 $axProcess = Start-Process -PassThru ($axClientPath_DEFINE + "`\Ax32.exe") -WindowStyle minimized -ArgumentList ($params + " -StartupCmd=Synchronize")
 if ($axProcess.WaitForExit($AXSYNCTIMEOUT_DEFINE) -eq $false)
    Throw ("Error: Synchronize did not complete ok")

 So the idea is that you should have a sync'ed data dictionary at the end of the process.
 This is not the case if  you ran into sync Errors ...

 You (can) / should also try to add

 $params = "`"" + $AXCONFIGPATH_DEFINE + "`" -lazyclassloading -lazytableloading -minimize -model=" + ($MODELTOBUILD_DEFINE) + " -internal=NoModalBoxes"

 The way it worked for me was, that even if it didn't prompted for the sync window, it still gave a blocking infolog window at the end of the process.

 And as a result of that, yes, the process will time-out with no telling what happen ... What to do in this case? Not sure yet, still researching ...


  1. i'm going through the sane problem with the blocking windows showing up and timming out my script. Have you found anything on this?

  2. i am facing same issue in my script automation. any solution found ?

    1. Hi. I think the only way is to take a workaround around this: I have not gotten to test the theory, but the idea is to have the ax process 'monitored' and see if any infolog windows are present and act accordingly if such an event happens - you should be able to get the infolog text as well as bypass it; or, another approach, but I am not a fan of doing this, modify the Info standard class to handle the output of a DB Synchronize error (I think this should be possible) - it leads however to undesirable compile issues when not using the external AxBuild compiler, in the sense that AX can not start the compilation and such.

  3. Create a file with the following content

    And then run it with:

    ax32 -lazyclassloading -lazytableloading -StartupCmd=Autorun_X:\autorun.xml

    Change "X:" to your script directory :-)