Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Batch job multitask wi...
Finance forum
Unanswered

Batch job multitask with dependency not working as expected

Posted on by 2
Hello dear community,
 
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

 
  • Judy Profile Picture
    Judy Microsoft Employee on at
    Batch job multitask with dependency not working as expected
    Moved to Finance Forum.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,142 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,979 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans