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

Community site session details

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

Canceling a DMF export through code

(0) ShareShare
ReportReport
Posted on by 446
Hi,
I have a requirement where a DMF export needs to be cancelled if one of the parameter field is not set correctly.
I could find an option in DMFDefinitionGroupExecution.update() and set the StagingStatus and TargetStatus to Cancelled but the export to staging still happens.
We don't want to throw error and error out the export because its not an issue with the export job but the parameter setup so we want to cancell the job and notify the middleware that this happened because of the internal parameter.
Any suggestion on how to cancel the export based on the condition will be appreciated.
Thanks!!
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    236,477 Most Valuable Professional on at
    Canceling a DMF export through code
    Could explain the business scenario, please?
     
    I'm confused by the current description. You seem to be saying that if parameters are wrong, you want to start export, but then cancel without actually failing it. Then you mentioned some middleware, but it's unclear what it has to do with the export? Don't you actually mean that the export is requested from outside F&O by a data management API? If so, it's important to say such things.
  • Dev Profile Picture
    446 on at
    Canceling a DMF export through code
    Hi Martin,
     
    Yes the export is requested from outside but we want to cancel that export request and send a message to the middleware that the parameter was not set to export through DMF which is a requirement we have.
    We have a custom parameter field which decides if we need to export the file or not based on another internal action.
     
    Thanks!
  • Martin Dráb Profile Picture
    236,477 Most Valuable Professional on at
    Canceling a DMF export through code
    How is the request made? Are you using a standard data management API? If so, which one?
  • Dev Profile Picture
    446 on at
    Canceling a DMF export through code
    Yes we are using the standard Data management package REST API
  • Martin Dráb Profile Picture
    236,477 Most Valuable Professional on at
    Canceling a DMF export through code
    Okay, how do you imagine it to work? Your original description was vague; with statements like "notify the middleware" without any details, and without any reference to the API used.
     
    For example, would you like to get an exception already when calling ExportToPackage/ExportToPackageAsync?
     
    The functions of the package API are methods defined on DataManagementDefinitionGroupEntity and you can use CoC to extend them, therefore changing the behavior is technically possible.
  • Dev Profile Picture
    446 on at
    Canceling a DMF export through code
    Yes, as early as possible would be good but how can I cancel the execution during ExportToPackage as I do not want to throw an error just cancel the execution.
  • Martin Dráb Profile Picture
    236,477 Most Valuable Professional on at
    Canceling a DMF export through code
    Why do you want to start an export and try to somehow cancel it? In my opinion, you shouldn't start the export at all if you don't want to run it. You also said you wanted to do it as soon as possible.
     
    I think it's time to finally respond to my first request and explain the business scenario.
  • Dev Profile Picture
    446 on at
    Canceling a DMF export through code
    Sorry for the confusion here since we are still formulating the best way to solve this, I was not very clear with the explanation.
    We have a custom parameter field which decides if a DMF export should be executed or not. We want to inform the middleware that the export could not complete due to the parameter set to not execute. 
    We do not want to show this execution as an error to the middleware just as a info that the execution was not started so I am not sure how we can acheive that without throwing error here as somehow when we check the DMF log it will show some sort of a status as error/cancelled so that is why I was thinking of cancellation but I am not sure how we can skip the complete initiation of the export in the standard methods
  • Martin Dráb Profile Picture
    236,477 Most Valuable Professional on at
    Canceling a DMF export through code
    I would check the parameter and throw an exception in ExportToPackage/ExportToPackageAsync. This meets your requirements to do the check as soon as possible and to notify the requesting system. Not throwing an exception would make the other system think that the export was accepted and it'd waste time waiting for the file to be exported. Not giving them the right response is a bug, in my opinion. You'd also have to build another communication channel to inform the other system that all files were actually rejected because of state of F&O that does not allow exports.
     
    The only requirement is doesn't meet is you don't want an exception, but mere I (don't) want isn't an argument for me. Think about business requirements behind your desire and compare its importance with the other conflicting requirements of yours. I think that throwing an exception is actually the right thing to do.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,964

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 564 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans