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, ...
Suggested Answer

DMF import multiple projects in one package checking end time in code

(3) ShareShare
ReportReport
Posted on by 1,269
Hello,
 
I would like to import the package of the multiple zip packages in DMF. I'd like to create a new batch job which will contain multiple batch tasks each of which will import one project after another in sequence. The next project will be imported only after the previous one is imported successfully.
 
If we tale a a look at the standard DMF import project batch which is created from this button
 
 
 
under the hood it runs DMFBatchImporter class which created a new batch job with one batch task like that
 
 
 
I'd like to create one batch job with multiple batch tasks each of which will import one separate DMF project and the new batch task should be created and started only after the previous one is ended successfully. In order to check that previous batch task is ended successfully I cannpt rely on the batch task end date time because it doesn't show the relevant time
 
 
the real time can be found in the project job history here
 
 
 
 
 
 
in order to check it I need from to time to check whether the job is finished and whether there is a field from above screenshot "end time" is filled up with value.
 
The question is there some best practice approach to do that in code? Maybe somewhere in the standard FO code it's done in some way. 
 
Thanks in prior.
Categories:
I have the same question (0)
  • Suggested answer
    Giorgio Bonacorsi Profile Picture
    3,292 on at
    Hello,

    You can use a data package that includes multiple data entities.
    This enables you to import several data entities in a defined sequential order, respecting dependencies between them: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/lcs-solutions/process-data-packages-lcs-solutions

    Thank you,
    Giorgio
  • Suggested answer
    Rashid.Ali Profile Picture
    423 on at

    You can use batch task dependencies to run projects in sequence.

    Alternatively, a better approach is to create one DMF project with multiple entities, which avoids the need for chaining and simplifies execution.

  • dark_knight Profile Picture
    1,269 on at
    Hello   Rashid.Ali
     
    OK. How to use batchtask dependencies if I can't rely neither on end status nor on entd datetime of the batch task? They aren't relevant. So the only option is to rely on the project job history as I see it now. The question waht is the best practice approach for checking the state of the job in the code? How to achieve that? I can write the code, for example, that can every 30 seconds check the state of the job, but I'm not sure it's elegant solution. I cannot place all the entites from all the packages in one package for now because those packages come separately to the user.
     
    Maybe it's possible to somehow create a batch task that will end at the same time as the project job? In that case I'll be able to rely on the end date time of the batch task.
  • Suggested answer
    Saalim Ansari Profile Picture
    708 on at
    Hi,
     
    Don’t check EndDateTime in a loop.
    Instead, rely on DMF execution status + batch task dependencies that’s the standard and safest approach
     
    select top 10 DefinitionGroup, ExecutionId, ENDDATETIME, * from DMFDefinitionGroupExecution 
     
    Hope this helps
    Saalim
  • dark_knight Profile Picture
    1,269 on at
    I mean I don't want to do the polling of the exustion status in the execution job. But I don't see any other way for now. Or maybe there is some other approach I can use? I can't rely on the batch task endtime whcih I explained above.
  • André Arnaud de Calavon Profile Picture
    305,182 Super User 2026 Season 1 on at
    Hi Dark Knight,
     
    Batch task dependencies as mentioned above should solve your challenge. This will have one batch job with multiple tasks. You can check if the next post is meeting your requirements: Creating Dependent Tasks in Dynamics 365 Finance and Operations Batch Jobs with X++ Code
  • Suggested answer
    Anthony Blake Profile Picture
    3,152 Super User 2026 Season 1 on at
     
    Is there a specific reason you want to orchestrate this via customisation and a batch job? 
     
    It seems like it could be really easy to achieve with an Azure logic app for orchestration, utilising the package API.
     
    Anthony
  • dark_knight Profile Picture
    1,269 on at
     
    Thanks for your answers,
     
    I'm traversing through the custom table with the list of packages and create a separate batch task for each package. Inside the batch task code I can check the status of DMF import job after it's finished and update the corrseponding custom table record with the status of the DMF import job. But since that batch task itself is created outside the checking code I don't think it's a best practise. I'm updating the table record from the different code, not there the custom table traversing code. What another approach can I use? 

    Thanks.

     
  • dark_knight Profile Picture
    1,269 on at
     
    For some reason I cannot use such approach.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 518

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans