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

Notifications

Announcements

No record found.

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
    237,770 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 692 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 558 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 364 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans