I am working on a requirement to create a batch job for DMF import project to run with multiple tasks(it mean multiple import project in a single batch job) having dependency of being finishedorerror. I have created a script and it is scheduling the the batch job with number of defined tasks correctly, but issue is only the first task is executed and the other ones remain in a status /not run/. I am sharing the code and snap, any kind of help will be much appreciated. Thank you
X++ Code:
BatchHeader batchHeader = BatchHeader::construct();
DMFBatchImporter batchImporter = new DMFBatchImporter();
DMFDefinitionGroup definitionGroup;
select definitionGroup where definitionGroup.DefinitionGroupName == 'Customer Group2';
batchImporter.batchInfo().parmBatchExecute(NoYes::Yes);
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');
RS_DMFProjectListBatchImporter integrationBatch = new RS_DMFProjectListBatchImporter();
integrationBatch.batchInfo().parmBatchExecute(NoYes::Yes);
integrationBatch.parmReadyForBatchRun(true);
DMFExecutionId batchExecutionIdlocal =
DMFPackageImporter::PrepareDefinitionGroupForImport('Customer payment method');
integrationBatch.parmExecutionId(batchExecutionIdlocal);
integrationBatch.batchInfo().parmGroupId('Batch1');
//batchHeader.parmCaption(strFmt('%1 - Test Log - %2', TestIntegrationBatch::description(), logRecId));
// 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