Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Batch job multitask with dependency not working as expected

(0) ShareShare
ReportReport
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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans