In Dynamics 365, when a plugin is run, it executes based on a pipeline execution model.
Plugins can be triggered by:
- A user action in the Dynamics 365 user interface, such as retrieving a record
- Events triggered by the Organization Service or the WebAPI, such as retrieving a record
Post-Operation events in the pipeline are processed either:
- synchronously – these plugins are are executed immediately and run in a specific order
- asynchronously – these plugins are executed by the Queue Agent and run later by the async service
Other events are processed synchronously.
The event pipeline is as following:
Event | Stage name | Stage number | Description | Sync/Async |
---|---|---|---|---|
Pre-Event | Pre-validation | 10 | Executes before the main system operation and outside the database transaction. | Sync |
Pre-Event | Pre-operation | 20 | Executes before the main system operation and executed within the database transaction. | Sync |
Platform Core Operation | MainOperation | 30 | This is the actual platform operation. No plugins registered here. | |
Post-Event | Post-operation | 40 | Executes after the main operation and within the database transaction (if sync). | Sync and Async |
Plug-ins that execute during the database transaction and pass an exception back to the platform cancel the core operation.
The pipeline is detailed here.
THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
[…] can see if we run this in the debugger, the Execution Pipeline stage is 10 (pre-event, pre-validation). As this executes outside the database, the IsInTransaction is […]
I was looking for this info last week. and this post made my day. Thank you so much for sharing this informative stuff.
What happen when we execute plugin Pre Operation and Post Operation /
Have a question for you, Sensei….
Custom APIs are registered on step 30… Debugging via PRT is not possible this way, but they list a workaround to register the plugin on step 40 (PostOp) for the same…. Why would they run on 30 specifically, and any other step of choice, say 10 or 20, like plugins?
Reference:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/custom-api#not-able-to-use-profiler-for-debugging
I read your blog and I really Liked this information over (pre-operation) but plz start to shoot youtube videos.
How to access attribute values that have been entered we want to validate if there is any record that already exists in the database and how to access those attribute values.
Basically , how to get Attribute values that user has entered without GUID