Skip to main content

Notifications

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.

  • PhillyNJ Profile Picture
    PhillyNJ 81 on at
    RE: DMFBatchImporter issues

    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();        
    }

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: DMFBatchImporter issues

    What is the status of the batch job itself?

  • Verified answer
    huijij Profile Picture
    huijij 19,811 on at
    RE: DMFBatchImporter issues

    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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans