web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

DMFBatchImporter issues

(0) ShareShare
ReportReport
Posted on by 81

Hi,

I am currently executing a DMF project from my code with:

DMFQuickImportExport::doPGImport(defintionGroup, executionId, true);

This works great, but it runs synchronous. I want to run it in batch mode. I tried the following (DMFBatchImporter):

 public void runInBatchMode(DMFExecutionId executionId, str definitionGroup)
    {
        BatchHeader           batchHeader;
        BatchInfo             localBatchInfo;
        DMFBatchImporter importAsBatch = new DMFBatchImporter();
        importAsBatch.parmExecutionId(executionId);
        importAsBatch.parmReadyForBatchRun(true);
        SysRecurrenceData     sysRecurrenceData = SysRecurrence::defaultRecurrence();
        sysRecurrenceData = SysRecurrence::setRecurrenceEndAfter(sysRecurrenceData, 1);

        localBatchInfo = importAsBatch.batchinfo();
        localBatchInfo.parmGroupId(definitionGroup);
        batchHeader = batchHeader::construct();
        batchHeader.addTask(importAsBatch);
        batchHeader.parmRecurrenceData(sysRecurrenceData);

        batchHeader.save();
        info("Batch job created");

    }

The batch job kicks off, but never finishes. The data is stuck in Pending status:

pastedimage1683571534997v1.png

Any thoughts?

Thanks.

I have the same question (0)
  • Verified answer
    huijij Profile Picture
    19,811 on at

    Hi PhillyNJ,

    Regarding this DMFBatchImporter class, I think there are many examples in AOT that you can refer to that call some known functions. And have you debugged your code yet?

    38421.png

  • Martin Dráb Profile Picture
    238,736 Most Valuable Professional on at

    What is the status of the batch job itself?

  • PhillyNJ Profile Picture
    81 on at

    Judy,

    Thank you!. I did search the AOT, but your suggestion put me on the right path.

    Here is the solution:

    DMFDefinitionGroup defGroup = DMFDefinitionGroup::find(defintionGroup, true);
    WSTG_Helpers::StartImportInBatch(defGroup, executionId);

    public static void StartImportInBatch(DMFDefinitionGroup _definitionGroup, DMFExecutionId executionId)
    {
            DMFBatchImporter batchImporter = new DMFBatchImporter();
            batchImporter.batchInfo().parmBatchExecute(NoYes::Yes);       
            batchImporter.parmReadyForBatchRun(true);
            DMFExecutionId xexecutionId = DMFPackageImporter::PrepareDefinitionGroupForImport(_definitionGroup.DefinitionGroupName, executionId, curExt(), true);
            batchImporter.parmExecutionId(xexecutionId);
            batchImporter.saveLast();
            batchImporter.batchInfo().doBatch();        
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 577 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans