A Practical Guide to Background Operations and Callback URL in Dynamics 365: Part 2

By | November 14, 2025

Operations and Callback URL in Dynamics 365

Handling large-scale data tasks in Dynamics 365 CRM can be challenging, especially when syncing thousands of records with external systems. Background Operations allow these resource-intensive tasks to run asynchronously, keeping the system responsive.

In this article, we’ll walk through the technical setup using a practical scenario: syncing thousands of records with an external system. You’ll learn how to create a Background Operation and use a Callback URL to get notified or trigger other processes automatically once the job completes.

For insights into synchronous vs asynchronous workflows and why Background Operations are essential for large data sets, refer to Part 1.

The Scenario: Syncing Records with External System

Many organizations use both Dynamics 365 CRM and an external ERP system, requiring regular synchronization of all customer and order data. This includes not only the records themselves but also related data in the external system.

Using a Background Operation allows this process to run asynchronously, without affecting other running processes. It also supports a Callback URL, which notifies the administrator automatically once the operation is completed, eliminating the need for manual monitoring.

With a Background Operation, all syncing logic can be consolidated into a single request, allowing Dynamics 365 to run the large job in the background without disturbing users, while automatically informing the system or administrators when the task is finished.

Technical Setup: Running Background Operations Asynchronously

To implement this in Dynamics 365, a Custom API containing the sync logic must be created and triggered via the ExecuteBackgroundOperation request.

Step 1: Create a Custom API

Create a Custom API in Dynamics 365 called SyncRecordsToExternalSystem. Back it with a plugin, which handles:

  • Querying Dynamics 365 records
  • Sending data to the external system via API
  • Handling responses and updating sync status flags

This plugin runs in the background, removing timeout limitations and efficiently processing thousands of records.

Step 2: Trigger the Background Operation

Next, you need a way to call your new Custom API. The key is that instead of executing your Custom API directly, you wrap it in an ExecuteBackgroundOperation request.

This tells Dynamics 365 to take your request (the asyncRequest) and run it as a background job, giving you back a BackgroundOperationId to track it.

Here is a C# code snippet, similar to the one from Part 1, but this time we are calling our new Custom API. This code would typically run in another plugin (e.g., on a scheduled job or button click).

public void Execute(IServiceProvider serviceProvider)
{

// Services

IPluginExecutionContext context =

(IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

 

ITracingService tracingService =

(ITracingService)serviceProvider.GetService(typeof(ITracingService));

 

IOrganizationServiceFactory serviceFactory =

(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

 

IOrganizationService service =

serviceFactory.CreateOrganizationService(context.UserId);

 

try

{

tracingService.Trace("Starting background sync operation...");

 

// 1. Create the request for your Custom API that syncs records.

var asyncRequest = new OrganizationRequest("sample_SyncRecordsToExternalSystem")

{

Parameters =

{

// You can pass parameters to your logic,

{"EntityName", "account"},

{"SyncMode", "Incremental"},

{"ExternalSystemUrl", "https://api.erpsystem.com/v1/customers"},

{"LastSyncDate", DateTime.UtcNow.AddDays(-1)}

}

};

 

// 2. Create the request to execute your Custom API in the background.

var request = new OrganizationRequest("ExecuteBackgroundOperation")

{

Parameters =

{

{"Request", asyncRequest },

 

// 3. Request a callback. This is a Power Automate Flow URL.

// This flow will be triggered when the job is done.

{"CallbackUri", "https://prod-123.westeurope.logic.azure.com/workflows/..." }

}

};

 

// Execute the background operation request

var response = service.Execute(request);

 

// This ID lets you monitor the job in the "Background Operations" view

tracingService.Trace($"BackgroundOperationId: {response["BackgroundOperationId"]}");

tracingService.Trace($"Location: {response["Location"]}");

}

catch (Exception ex)

{

tracingService.Trace($"Exception: {ex.Message}");

throw new InvalidPluginExecutionException("Sync background job failed.", ex);

}

}

Step 3: Monitor the Background Operation

You can monitor the progress under Advanced Settings → Settings → System Jobs → Background Operations, where you can view status, duration, parameters, and error logs easily.

Step 4: Handle the Completion with the Callback URL

This is where the magic happens. Your duplicate job might take 30 minutes, 4 hours, or even a whole day. You don’t want to sit and watch the “System Jobs” screen.

The CallbackUrl you provided (e.g., the URL for a Power Automate HTTP-triggered flow) will be called automatically by Dynamics 365 the moment the operation finishes.

Your Power Automate flow can then:

  • Parse the response from the job.
  • Check if it ‘Succeeded’ or ‘Failed’.
  • Send an email to the CRM Administrator with a summary (“Sync job complete. 2,456 records successfully synced to external system.”).
  • Log the completion details for auditing.
  • Update a sync status dashboard or field.
  • Trigger error handling workflows if the sync failed.
  • Schedule the next incremental sync.

Conclusion

Handling large-scale integration operations can be challenging, but Dynamics 365 provides the right tools to manage them efficiently. By combining Custom APIs with the ExecuteBackgroundOperation message, you can safely run heavy, resource-intensive tasks like external system synchronization without affecting users or system performance.

With the CallbackUrl, Dynamics 365 automatically notifies you once the background job is completed. It can trigger actions like sending a summary email, logging results, updating dashboards, or scheduling the next sync, removing the need for manual monitoring.

FAQs: Dynamics 365 Background Operations & Callback URL

What are Background Operations in CRM?

Background Operations in Dynamics 365 CRM are asynchronous processes that run in the background, allowing long-running or resource-intensive tasks to execute without slowing down the system. They are ideal for bulk updates, data migration, or integration with external systems.

How does a Callback URL work in CRM?

A Callback URL is an endpoint (like a Power Automate flow, webhook, or API) that Dynamics 365 CRM automatically calls when a Background Operation completes. It enables automatic notifications, follow-up workflows, dashboard updates, or error handling.

Why are asynchronous workflows better for large data sets in Dynamics 365?

Asynchronous workflows, such as Background Operations, prevent system slowdowns or timeout errors when processing thousands of records. Unlike synchronous workflows, they allow users to continue working while large data operations run in the background.

Can Background Operations sync data with external systems?

Yes. Background Operations in Dynamics 365 CRM can execute custom APIs to synchronize records with external ERP or other third-party systems efficiently, ensuring data consistency and minimal disruption to users.

How can administrators monitor Background Operations?

Administrators can monitor Background Operations under Advanced Settings → System Jobs → Background Operations, checking status, parameters, duration, and error logs for each job.

Category: Dynamics 365 Technical Tags:

About Sam Kumar

Sam Kumar is the Vice President of Marketing at Inogic, a Microsoft Gold ISV Partner renowned for its innovative apps for Dynamics 365 CRM and Power Apps. With a rich history in Dynamics 365 and Power Platform development, Sam leads a team of certified CRM developers dedicated to pioneering cutting-edge technologies with Copilot and Azure AI the latest additions. Passionate about transforming the CRM industry, Sam’s insights and leadership drive Inogic’s mission to change the “Dynamics” of CRM.