When we use the Microsoft Dynamics AX command line parameters to trigger a startup command with running the client, it is a very common situation that our metadata is altered.
There could be many scenarios where the metadata change requires user interaction (like a possible index violation, removing fields, etc) on a form, where you could review the changes before it is permanently committed to the database. This is not ideal if you would like to do automated tasks, like running a workflow step on a Team Foundation Server build controller (code / metadata synchronization, XPO import).
Fortunately there is a way of suppressing this user interaction, by setting a global variable.
You may try adding a new field to any of your tables, save the changes, then delete the field and cancel the synchronization window. After that, running the following job will suppress the interaction form, and remove your field from the SQL database:
static void WIK_SilentDBSynch(Args _args) { #define.showSysSqlSync('showSysSqlSync') SysGlobalCache gc = appl.globalCache(); FormName owner = formStr(SysSqlSync); // Store the pre-existing Global Cache state boolean gcEntryExists = gc.isSet(owner, #showSysSqlSync); anytype gcValue = gc.get(owner, #showSysSqlSync); // Suppress user interaction gc.set(owner, #showSysSqlSync, NoYes::No); // Synchronize the Data Dictionary appl.dbSynchronize(0, false); // Restore the previous Global Cache state if (gcEntryExists) { gc.set(owner, #showSysSqlSync, gcValue); } else { gc.remove(owner, #showSysSqlSync); } }
Leave A Comment