As a Dynamics 365 CE developer or architect, you’ve likely faced the decision: Should I use a Plugin? Power Automate Flow? Or push this through Azure Service Bus?
Each of these has its place in a well-architected Dynamics solution—but using the wrong one can lead to performance bottlenecks, scalability issues, or even governance chaos. This post outlines when to choose each and what kind of volume or scenario should guide your decision.
1. Plugins – For Real-Time, Low-Latency Business Logic
When to Use:
- Real-time processing is critical (e.g., data validation, field calculations, or setting default values).
- Synchronous feedback is needed to the user.
- Logic must run immediately during create/update/delete events.
Ideal Volume:
Plugins perform well under moderate volumes, but they run within the Dataverse transaction pipeline. For high-throughput or complex logic, consider async plugins or offloading logic.
Key Considerations:
- Keep it lean—avoid external service calls.
- Run business-critical logic that must complete before the record is saved.
- Use Pre-Operation for validation/transforms and Post-Operation for side effects like record creation.
// Example: Simple Plugin to set a default value
public class SetDefaultValuePlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var entity = context.InputParameters["Target"] as Entity;
entity["default_field"] = "Default Value";
}
}
2. Power Automate Flows – For Simple, Low to Medium Volume Automation
When to Use:
- Lightweight automation or notification logic.
- Data movement across systems or environments (especially using standard connectors).
- End-user-driven logic that doesn’t require deep dev knowledge.
Ideal Volume:
Low to medium volume (a few hundred to a couple thousand records/day). Flows aren’t built for bulk-processing thousands of records in tight loops—they may throttle or hit API/service limits.
Key Considerations:
- Excellent for prototyping and low-code implementations.
- Watch out for API limits (especially for non-premium connectors).
- Use with connection references for better ALM integration in CI/CD pipelines.
Pro Tip: Avoid looping over large datasets in Flows. Instead, consider batch processing or offloading to Azure.
3. Azure Service Bus – For Decoupled, Scalable, High-Volume Scenarios
When to Use:
- Integration with external systems asynchronously.
- Decoupling logic from CRM to avoid overloading Dataverse.
- Processing large volumes of data reliably in the background.
Ideal Volume:
High-volume (thousands to millions of messages/day). Azure Service Bus handles burst traffic, retries, dead-lettering, and load balancing with ease.
Key Considerations:
- Requires Azure Subscription and app registrations for authentication.
- Custom Azure Functions or Logic Apps can process the messages downstream.
- Ideal for operations that don’t need to respond instantly to the end user.
// Example: Service Bus message payload
{
"entityId": "12345",
"operation": "create",
"data": { "field1": "value1" }
}
So... Which One Do I Use?
Tool | Best For | Volume | Latency | Complexity |
---|---|---|---|---|
Plugins | Real-time, synchronous logic | Low to moderate | Low | High (dev-heavy) |
Power Automate | Simple automation, low-code | Low to medium | Medium | Low (citizen-dev) |
Azure Service Bus | High-volume, decoupled integration | High (thousands+) | High (async) | Medium to high |
Final Thoughts
It's not about one being better than the other—it’s about choosing the right tool for the job. Plugins offer speed, Flows offer simplicity, and Service Bus offers resilience and scale. Understand your use case, expected volume, and long-term maintainability before picking your approach.
In a future post, I’ll explore hybrid patterns like calling Azure Service Bus from plugins, scaling bulk jobs via batch-triggered flows, and why Flow-only architecture can be risky for high-volume workloads.