Domain 6 β€” Module 1 of 3 33%
24 of 26 overall
Domain 6: Develop Integrations Free ⏱ ~11 min read

Publishing Dataverse Events

Push events from Dataverse to external systems. Learn to publish events using IServiceEndpointNotificationService and the Plug-in Registration Tool, and choose the right listening strategy.

Sending events to the outside world

Simple explanation

Think of publishing events like a news agency sending bulletins.

When something important happens in Dataverse, it can broadcast that event to external systems. There are two ways: automatically (configure it in PRT β€” no code) or programmatically (C# code using IServiceEndpointNotificationService for conditional publishing).

Two publishing approaches

PRT for 'publish everything'; code for selective publishing
FeaturePRT Registration (No Code)IServiceEndpointNotificationService (Code)
SetupConfigure in Plug-in Registration ToolWrite C# in a plug-in
Conditional publishingNo β€” publishes on every matching eventYes β€” publish only when your code decides
Custom payloadStandard execution contextExecution context β€” you control WHEN to publish (the payload is still the context, enriched via shared variables)
Plug-in modeN/A β€” configured via PRT stepMust be registered as an ASYNCHRONOUS plug-in
Best forSimple event broadcastingConditional publishing, enriched payloads

Code-based publishing

// IMPORTANT: This plug-in must be registered as ASYNCHRONOUS
public class ConditionalEventPublisher : IPlugin
{
    public void Execute(IServiceProvider serviceProvider)
    {
        var context = (IPluginExecutionContext)
            serviceProvider.GetService(typeof(IPluginExecutionContext));
        Entity target = (Entity)context.InputParameters["Target"];
        
        // Only publish if order value exceeds threshold
        decimal orderValue = target.GetAttributeValue<Money>("totalamount")?.Value ?? 0;
        
        if (orderValue > 10000)
        {
            var notificationService = (IServiceEndpointNotificationService)
                serviceProvider.GetService(typeof(IServiceEndpointNotificationService));
            
            Guid endpointId = new Guid("your-endpoint-id");
            notificationService.Execute(
                new EntityReference("serviceendpoint", endpointId), context);
        }
    }
}

Choosing a listening strategy

Choose based on reliability needs and consumer count
ListenerDeliveryReliabilityBest For
WebhookHTTP POST to URLLow β€” lost if endpoint downSimple notifications, low volume
Service Bus (Queue)Message in queueHigh β€” guaranteed deliveryReliable processing, one consumer
Service Bus (Topic)Message to topicHigh β€” filtered subscriptionsMultiple subscribers
Event HubEvent in streamHigh β€” massive throughputTelemetry, analytics, streaming
Power AutomateFlow triggerMedium β€” built-in retryLow-code reactions
Exam tip: Webhook vs Service Bus

If the question mentions reliability, guaranteed delivery, or consumer might be offline β€” the answer is Service Bus. If it says simple notification to an always-available endpoint β€” webhook is fine.

Question

What is IServiceEndpointNotificationService?

Click or press Enter to reveal answer

Question

What is the difference between Service Bus queues and topics?

Click or press Enter to reveal answer

Knowledge Check

A developer needs to publish Dataverse events to a warehouse system that may be offline for hours during maintenance. Which approach?

Next up: Service Endpoints β€” configuring webhooks, Azure Service Bus, and Event Hub.