Custom Business Events in Dataverse

Loading


In today’s interconnected world, systems rarely operate in isolation. Modern applications are expected to communicate seamlessly across services and platforms. Microsoft Dataverse addresses this challenge by supporting Business Events—a powerful way to notify external systems when important business actions occur. While standard events exist for common processes, Custom Business Events let you define your own events tailored to your organization’s needs.

Custom Business Events enable real-time integration, automation, and extensibility, transforming Dataverse into a true event-driven platform. In this article, we’ll explore what custom business events are, how to create and use them, and the best practices for implementation.


What Are Business Events?

Business Events are messages that get triggered by actions in Dataverse and can be published to external systems such as:

  • Azure Event Grid
  • Azure Service Bus
  • Webhooks
  • Power Automate flows

These messages notify subscribers that a specific business action has occurred, enabling near real-time responses.

For example:

  • A sales order is submitted → Trigger a warehouse process.
  • A case is escalated → Send a notification to Slack.
  • A payment is received → Notify the accounting system.

What Are Custom Business Events?

While Dataverse provides standard business events (e.g., when a record is created or updated), custom business events allow developers or makers to define specific business milestones or conditions that matter to their organization.

Example Use Cases:

  • A “Gold Customer” threshold is reached.
  • An employee completes onboarding.
  • A project milestone is achieved.
  • A custom approval process is completed.

These events don’t necessarily correspond to CRUD (Create, Read, Update, Delete) operations, but instead represent higher-level business semantics.


Key Components of a Custom Business Event

  1. Business Event Definition – Defines the structure and metadata of the event.
  2. Triggering Mechanism – When and how the event should fire (e.g., via plugin, Power Automate, or custom code).
  3. Payload – Custom data to include in the event message (fields, values, context).
  4. Publisher and Topic – Identifies where and how the event will be delivered.
  5. Subscriber – The external system or flow that consumes the event.

How to Create a Custom Business Event

Creating a custom business event in Dataverse involves a few key steps:


Step 1: Define a Custom Business Event

  1. Go to Power Apps Maker PortalSolutions → Click + New → Select Business Event.
  2. Enter a name, display name, and optionally link to a primary table.
  3. Define the custom payload fields (e.g., email, status, order total).
  4. Save and publish the business event.

✅ You can define up to 100 custom business events per environment.


Step 2: Create a Trigger for the Event

Custom business events are not triggered automatically. You must define when they fire. You can trigger them using:

🔹 1. Power Automate

Use the “Send Business Event” action in a flow:

  • Trigger the flow based on logic (e.g., record is updated, condition met).
  • Use the action to send the custom business event and include the required payload.

🔹 2. Plugins or Custom Code

Trigger the event from C# plugin code using the SendBusinessEventRequest.

var request = new SendBusinessEventRequest
{
    BusinessEventId = new Guid("your-business-event-id"),
    Payload = new Dictionary<string, object>
    {
        { "customeremail", "john.doe@example.com" },
        { "orderamount", 1200.50 }
    }
};
service.Execute(request);

🔹 3. JavaScript (Client-Side)

Though less common, client-side code can also be used to call APIs that trigger the event via custom web services.


Step 3: Subscribe to the Event

You need an external system or process to consume the business event:

Options:

  • Azure Event Grid or Service Bus
  • Azure Logic Apps
  • Custom webhooks
  • Power Automate (trigger: When a Business Event occurs)

Power Automate provides an easy way to build event-driven flows:

  • Trigger: When a business event occurs (Dataverse)
  • Add actions like sending an email, calling APIs, or writing to another system

Business Event Structure and Payload

When you send a business event, the message includes:

  • Event name
  • Event time
  • Correlation ID
  • Payload (custom-defined fields)
  • Environment metadata

This standard structure ensures the event is traceable and can be handled reliably across platforms.


Benefits of Using Custom Business Events

✅ 1. Real-Time Integration

No need to poll or run scheduled syncs—events are published instantly.

✅ 2. Decoupled Architecture

Publishers and subscribers are loosely coupled. Changing one does not affect the other.

✅ 3. Improved Performance

Rather than chaining logic directly in Power Automate or plugins, use events to distribute workload asynchronously.

✅ 4. Business-Driven Logic

You define what “events” matter to your organization. These are not limited to data CRUD operations.


Security and Governance

  • Business Events follow Dataverse’s role-based security model.
  • Only users with permission can send or create events.
  • Event payloads should avoid including sensitive data unless encrypted or secured.

Use Application Users and Azure Managed Identities when integrating with external systems to maintain a secure setup.


Monitoring and Troubleshooting

To monitor custom business events:

  • Use the Power Platform Admin Center to view telemetry.
  • Track success/failure of Power Automate flows triggered by business events.
  • Use Azure Monitor or App Insights if events are published to Azure.

Always include a Correlation ID in your event metadata to help trace transactions across systems.


Best Practices

🔸 1. Keep Events Small and Focused

Avoid bloated payloads. Include only the data the subscriber needs.

🔸 2. Use Semantic Naming

Event names should reflect business logic (e.g., OnboardingComplete, GoldTierAchieved) rather than technical operations.

🔸 3. Handle Failures Gracefully

External systems should retry on failure or use dead-letter queues in Azure.

🔸 4. Document Your Events

Maintain a registry or catalog of custom events, payloads, and subscribers for better governance.


Real-World Example: Loan Processing System

Let’s say a bank has a custom Dataverse app for loan approvals. When a loan is approved, it needs to:

  • Notify the accounting system
  • Send an SMS to the customer
  • Trigger document generation

Workflow:

  1. A Power Automate flow triggers when a loan record status = Approved.
  2. The flow sends a custom business event named LoanApproved.
  3. Azure Event Grid receives the event and fans it out to:
    • Azure Function (to notify accounting)
    • Twilio API (to send SMS)
    • Power Automate (to generate PDFs)

This approach avoids embedding all logic in one flow and allows scalable integration.


When to Use Custom Business Events

✅ Use them when:

  • You need real-time updates to external systems.
  • You want to avoid tightly coupled automation flows.
  • Business stakeholders care about custom milestones or outcomes.
  • You work with Azure Event Grid, Service Bus, or external APIs.

Avoid them when:

  • You’re handling purely internal logic (business rules may be better).
  • The process is entirely synchronous or doesn’t involve integration.
  • Your app doesn’t support async or event-based design.



Leave a Reply

Your email address will not be published. Required fields are marked *