X++ Code:
DMFBatchImporter batchImporter = new DMFBatchImporter();
DMFDefinitionGroup definitionGroup;
batchImporter.parmReadyForBatchRun(true);
DMFExecutionId batchExecutionId =
DMFPackageImporter::PrepareDefinitionGroupForImport(definitionGroup.DefinitionGroupName);
batchImporter.parmExecutionId(batchExecutionId);
batchImporter.batchInfo().parmGroupId('Batch1');
batchHeader.addTask(batchImporter);
batchHeader.addRuntimeTask(batchImporter, BatchHeader::getCurrentBatchTask().RecId);
batchHeader.parmBatchGroup('Batch1');
integrationBatch.batchInfo().parmBatchExecute(NoYes::Yes);
integrationBatch.parmReadyForBatchRun(true);
DMFExecutionId batchExecutionIdlocal =
DMFPackageImporter::PrepareDefinitionGroupForImport('Customer payment method');
integrationBatch.parmExecutionId(batchExecutionIdlocal);
integrationBatch.batchInfo().parmGroupId('Batch1');
// batchHeader.addTask(integrationBatch, BatchConstraintType::And);
batchHeader.addRuntimeTask(integrationBatch, BatchHeader::getCurrentBatchTask().RecId, BatchConstraintType::And);
batchHeader.addDependency(integrationBatch, batchImporter, BatchDependencyStatus::Finished);
batchHeader.save();
You can see only the first import project from bottom executed and the other is in not run state