Applicable to all AX7 releases.
If you are following https://ax.help.dynamics.com/en/wiki/recurring-integrations/ to setup your recurring imports, and if you are trying to use a data package with multiple entities, you may notice that the server shows a “preprocessing failure”. This is a bug. Until this is fixed, a workaround is to over-layer the ApplicationFoundation:
Create a new class:
class DMFSchedulerStatusUpdate
{
using Microsoft.Dynamics.AX.Framework.Tools.DataManagement.Serialization;
[DataEventHandler(tableStr(Batch), DataEventType::Updated)]
public static void Batch_onUpdated(Common sender, DataEventArgs e)
{
Batch task = sender;
if(task.Status == BatchStatus::Finished || task.Status == BatchStatus::Error && task.ClassNumber == className2Id(identifierStr(DMFImportTaskScheduler)))
{
container params = task.Parameters;
DMFExecutionId executionId = conPeek(params,3);
DMFIntegrationBridge::updateStatus_New(executionId);
}
}
}
Customize DMFIntegrationBridge:
public static void updateStatus_New(dmfExecutionId executionId)
{
IntegrationActivityMessageTable messageStatusTable;
IntegrationActivityRuntimeExecutionTable runtimeExecutionTable;
select firstonly messageStatusTable
join
runtimeExecutionTable where runtimeExecutionTable.ExecutionId == executionId &&
runtimeExecutionTable.MessageIdentifier == messageStatusTable.MessageId;
DMFIntegrationBridge bridge = new DMFIntegrationBridge();
ActivityMessageContext ActivityMessageContext = new ActivityMessageContext();
ActivityMessageContext.MessageId = guid2Str(messageStatusTable.MessageId);
ActivityMessageContext.ExecutionCorrelationId = str2Guid(messageStatusTable.ExternalCorrelationId);
// Get status for bridge result
IntegrationBridgeResults bridgeResult = DMFIntegrationBridgeHelper::GetStateOfExecution(executionId, false);
// Set post processing state
bridge.postProcessMessage(ActivityMessageContext, executionId, bridgeResult);
}