Force synchronization in Microsoft Dynamics AX 2012 using X++
Dictionary dictionary;
int iLoop;
int totalTablesCount;
TableId tableId;
Application application;
SysOperationProgress progress;
StackBase errorStackBase;
ErrorTxt error;
;
application = new Application();
dictionary = new Dictionary();
totalTablesCount = dictionary.tableCnt();
progress = new SysOperationProgress();
progress.setTotal(totalTablesCount);
progress.setCaption("@SYS90206");
errorStackBase = new StackBase(Types::String);
try
{
for (iLoop = 1; iLoop <= totalTablesCount; iLoop++)
{
tableId = dictionary.tableCnt2Id(iLoop);
progress.setText(dictionary.tableName(tableId));
application.dbSynchronize(tableId, false, true, false);
progress.incCount();
}
}
catch (Exception::Error)
{
error = strFmt("Error in table Id: %1 , Table Name : %2", tableId, dictionary.tableName(tableId));
errorStackBase.push(error);
retry;
}
setPrefix("@SYS86407");
error = errorStackBase.pop();
while (error)
{
error(error);
error = errorStackBase.pop();
}
Comments
Post a Comment