Sam June 28, 2026 0

Introduction

One of the most common troubleshooting questions among Dynamics 365 developers is:

Why is my plugin executing multiple times for a single operation?

You update a record once, but the plugin seems to execute twice, three times, or even more. In some cases, this behavior is expected. In others, it can indicate a configuration issue or an implementation problem.

Understanding why a plugin executes multiple times is essential for improving performance, preventing recursion, and building reliable Dynamics 365 solutions.

πŸ“š Related Article

Dynamics 365 Plugin Execution Pipeline

Understand how plugin stages execute before troubleshooting plugin behavior.

Is Multiple Plugin Execution Always a Problem?

Not necessarily.

A plugin executing multiple times does not automatically mean something is wrong.

Consider the following scenario:

User Updates Account
        ↓
Account Plugin Executes
        ↓
Plugin Updates Contact
        ↓
Contact Plugin Executes

Multiple plugin executions can be completely normal depending on your business logic and plugin registrations.

The goal is to determine whether the additional executions are expected or unintended.

Common causes of multiple plugin executions in Dynamics 365

Cause 1: Missing Filtering Attributes

One of the most common reasons a plugin appears to execute too often is the absence of Filtering Attributes.

Suppose a plugin should execute only when the Credit Limit field changes.

Without Filtering Attributes:

Name Updated
        ↓
Plugin Executes

Phone Updated
        ↓
Plugin Executes

Website Updated
        ↓
Plugin Executes

Every update operation triggers the plugin, even when the relevant field was not modified.

By configuring Filtering Attributes, the plugin executes only when specific attributes are included in the update request.

πŸ“š Related Article

Filtering Attributes in Dynamics 365 Plugins

Learn how Filtering Attributes reduce unnecessary plugin executions and improve performance.

Cause 2: Updating the Same Record Inside the Plugin

This is one of the most common causes of repeated executions.

Consider the following code:

Entity account = new Entity("account");
account.Id = target.Id;
account["new_status"] = "Processed";

service.Update(account);

Execution flow:

Account Updated
        ↓
Plugin Executes
        ↓
service.Update(Account)
        ↓
Plugin Executes Again

Because the plugin updates the same record, it triggers itself again.

If not handled correctly, this can create recursive execution chains that continue until Dynamics 365 stops the process.

πŸ“š Related Article

Plugin Depth Exceeded Error in Dynamics 365

Learn how recursive plugin execution increases depth and eventually causes runtime failures.

Recursive plugin execution causing multiple executions in Dynamics 365

Cause 3: Multiple Plugin Steps Registered

Sometimes the issue is not the code but the registration.

A single plugin assembly may have multiple registered steps:

Plugin Step 1
Update Account

Plugin Step 2
Update Account

Plugin Step 3
Update Account

A single update operation can execute all three steps.

When troubleshooting, always review your Plugin Registration Tool configuration and verify the number of registered steps.

Cause 4: Multiple Plugins on the Same Table

Several plugins may be registered against the same table and message.

Example:

Account Updated
        ↓
Plugin A Executes
        ↓
Plugin B Executes
        ↓
Plugin C Executes

When reviewing logs, it may appear that a single plugin executed multiple times when in reality several different plugins participated in the transaction.

Always verify which plugin generated the execution record.

Cause 5: Power Automate Updating the Same Record

Power Automate is another common source of additional plugin executions.

Consider the following flow:

User Updates Account
        ↓
Plugin Executes
        ↓
Power Automate Flow Triggered
        ↓
Flow Updates Account
        ↓
Plugin Executes Again

From a developer’s perspective, it may look like the plugin fired twice.

In reality, the second execution was triggered by the update performed by the Power Automate flow.

This scenario is becoming increasingly common in environments that combine plugins and cloud flows.

Cause 6: Plugin Registered on Multiple Messages

The same plugin code can be registered on multiple events.

Example:

Create
Update
Assign
SetState

As a result, the plugin may execute under several different scenarios.

Always verify:

  • Message
  • Primary Entity
  • Stage
  • Execution Mode

when investigating multiple executions.

How to Identify the Root Cause

The easiest way to determine why a plugin is executing multiple times is by using Plugin Trace Logs.

Log important execution details such as:

tracingService.Trace(
    $"Message: {context.MessageName}");

tracingService.Trace(
    $"Depth: {context.Depth}");

tracingService.Trace(
    $"UserId: {context.UserId}");

tracingService.Trace(
    $"Primary Entity: {context.PrimaryEntityName}");

These values often reveal exactly what is triggering the additional executions.

πŸ“š Related Article

Plugin Trace Logs in Dynamics 365

Learn how to capture detailed debugging information and troubleshoot plugin behavior using Plugin Trace Logs.

Best Practices

To avoid unnecessary plugin executions:

βœ” Configure Filtering Attributes for Update plugins.

βœ” Avoid updating the same record unless absolutely necessary.

βœ” Prefer Pre-Operation plugins when possible.

βœ” Review plugin registrations regularly.

βœ” Monitor execution depth during debugging.

βœ” Use Plugin Trace Logs to understand execution paths.

βœ” Be aware of Power Automate flows and integrations that update records.

βœ” Keep plugin logic focused and efficient.

Frequently Asked Questions

Why is my plugin executing twice?

Common causes include recursive updates, multiple plugin steps, missing Filtering Attributes, and Power Automate flows updating the same record.

Can Power Automate trigger plugins?

Yes. Any create or update operation performed by a Power Automate flow can trigger registered plugins.

Does Context.Depth indicate recursion?

Not always. However, continuously increasing depth values often indicate recursive plugin execution.

How do I stop a plugin from executing multiple times?

Configure Filtering Attributes, avoid unnecessary updates, review registrations, and monitor execution depth.

Should I use Plugin Trace Logs for debugging?

Absolutely. Plugin Trace Logs provide valuable insight into execution flow and are one of the best troubleshooting tools available to Dynamics 365 developers.

Conclusion

A plugin executing multiple times is one of the most common troubleshooting scenarios in Dynamics 365 development. While multiple executions are sometimes expected, they can also indicate configuration issues, recursive updates, or interactions with other components such as Power Automate.

By understanding Filtering Attributes, plugin registrations, execution depth, and tracing techniques, developers can quickly identify the root cause and build more efficient, reliable plugin solutions.

The next time a plugin appears to execute more than once, don’t assume it’s a bugβ€”start by identifying what is triggering the additional execution and work backward from there.

Category: