Showing posts with label Plugin Event Pipeline Stage of Execution. Show all posts
Showing posts with label Plugin Event Pipeline Stage of Execution. Show all posts

Wednesday, August 23, 2023

Understanding the Plugin Event Pipeline Stage of Execution - Dynamics 365 CE

 Understanding the Plugin Event Pipeline Stage of Execution. 

 

To Learn more about Plugin Development: Follow:  

 

 

Before diving into the stages, let's grasp the essence of the plugin event pipeline: 

  • Events and Triggers: The Dynamics 365 CE event pipeline triggers your plugin code based on events like record creation, update, or deletion. 

  • Stages and Steps: The pipeline is organized into stages, each comprising multiple steps. These steps define the order of execution for your plugins. 


 

Exploring the Stages of Execution 

 

1. Pre-Validation Stage: 

  • Purpose: This is the earliest stage, where data is validated before any system changes occur. 

  • Usage: Ideal for validation checks, like mandatory field validations or business rule enforcement. This stage occurs prior to form validation and security checks are being applied.

  • Execution: Plugin Registered in this stage, may execute outside of the Database Transaction. 

  • Important Note: If your plugin logic alters data, you must set it to execute synchronously to ensure data integrity. 

 

2. Pre-Operation Stage: 

  • Purpose: Here, you can modify the data before the main system operation takes place. 

  • Usage: Often utilized for calculations or data normalization before updates are applied. 

  • Execution: Plugin Registered in this stage, may execute within the Database Transaction. 

  • Use with Caution: Excessive changes can result in performance issues. Be mindful of efficient code execution. 

 

3. Post-Operation Stage: 

  • Purpose: This stage operates after the main system operation and database transaction. 

  • Usage: Suitable for sending notifications, triggering secondary processes, or logging data changes. 

  • Execution: Plugin Registered in this stage, may execute within the Database Transaction. 

  • Performance Matters: Given its post-transaction nature, this stage is typically asynchronous to maintain system performance. 



Event 

Stage Name 

Stage Number 

Description 

Pre-Event 

Pre-Validation 

10 

Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage may execute outside the database transaction. 

Pre-Event 

Pre-Operation 

20 

Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage are executed within the database transaction. 

Platform Core Operation 

Main- Operation 

30 

In-transaction main operation of the system, such as create, update, delete, and so on. No custom plug-ins can be registered in this stage. For internal use only. 

Post-Event 

Post-Operation 

40 

Stage in the pipeline for plug-ins which are to execute after the main operation. Plug-ins registered in this stage are executed within the database transaction. 

 

Tips for Effective Utilization 

  • Purpose-Driven Selection: Choose the appropriate stage based on your plugin's intended purpose and scope. 

  • Consider Order: Within each stage, steps are executed sequentially. Consider the order in which your plugin logic should run. 

  • Performance Optimization: Minimize the number of steps and the complexity of logic to maintain system performance. 

  • Error Handling: Implement robust error handling and validation in pre-stages to prevent erroneous data modification. 

 

 

Conclusion 

By understanding the stages of execution, you're equipped to orchestrate plugin logic that seamlessly aligns with business processes. 

 


Stay tuned for more in-depth explorations into the Dynamics 365 CE Platform and Plugin Development. 

#Dynamics365 #Development #Plugin #PowerApps #PowerPlatform 

 



Next Steps: Learn more about other powerful features of Plugin!