Study FAQ
How do I submit a Dataverse background operation and verify whether it succeeded?
Also asked as 2
- How can I track the final result after Dataverse accepts an asynchronous custom API request?
- What should a client save and check after Dataverse returns 202 for a background operation?
Answer
Use Dataverse background operations to submit an eligible custom API without keeping the connection open. The feature is documented as preview. A Web API response of 202 Accepted confirms submission. Save x-ms-dyn-backgroundoperationid and Location, and record success only after the terminal result reports it. The custom API plug-in still has its two-minute execution timeout. Dataverse background operations (preview)
The initiating user needs read and write privileges on the background operation table as well as authorization for the underlying request. Send the Web API request with Prefer: respond-async. In an SDK client, use OrganizationRequest("ExecuteBackgroundOperation") with the custom API's OrganizationRequest in the Request parameter. Persist the operation reference with the application's work identifier before allowing a restart to pick up monitoring. Background operation submission and required privileges · Custom API request contract
Check the returned status monitor or the background operation row. These are different resources. If polling, allow at least a minute between checks as Microsoft recommends. Inspect the status reason and output or error because a completed state can represent success, failure or cancellation. A completion callback or OnBackgroundOperationComplete can also signal that the app should inspect the result. If the monitor is temporarily unavailable, keep the operation unresolved and investigate the existing ID. Test an accepted request that later fails and confirm the app reports failure.
Full explanation
AB-400: Reliable Dataverse Bulk and Background Operations
Study guide · AB-400
Read the full explanation