Registering a Plugin
First step is to sign in to Plugin Registration Tool with your Dynamics 365 account (tool available in the CRM SDK, which you can download from the Microsoft Website).
![]()
Next thing is to register the assembly (.DLL) as a plugin in Dynamics 365, as shown below.
![]()
Load the assembly (.DLL) file, which we have created, using Visual Studio. Complete all 5 steps by selecting the 2highlighted options.
![]()
Now, you can create the step, as shown below.
![]()
After registering the custom plugin, you should mention when it must be triggered. This can be done by creating a new step, as shown below. The message given below in the example says the plugin will be triggered during the create record (Message: Create). Similarly, you can create one for updating and deleting also.
![]()
Another important thing is Event pipeline stage of Execution. This says about when exactly the plugin should trigger. Before Validation (Pre-Validation)/ Saving (Pre-Operation)/ After Saving (Post-Operation).
![]()
Debugging a custom plugin in Dynamics 365
To debug a custom plugin in Dynamics 365, you need to follow a few steps, which are listed below.
Click Install profiler from the top.
![]()
Now, enable the profiling for the steps.
![]()
To set the values in Profiler Settings, proceed, as shown below.
![]()
Once you have created the profiler, you can see the PluginProfiler in all the solutions.
![]()
Now, you are ready to debug the plugin.
Go to Visual Studio and attach the process “PluginRegistration.exe”.
![]()
![]()
Go to Plugin Registration Tool, click Debug icon, as shown below
![]()
Select Profile, Assembly location and plugin from the dropdown.
![]()
Select the assembly (.DLL) from the path, where Visual Studio has created the .DLL file.
![]()
After selecting the assembly, you should select the plugin from the dropdown and click Start Execution. You will find the cursor in the break point in Visual Studio.
Summary
I hope this will be helpful for you to debug the custom plugin for Dynamics 365. In my next article, I will come up with a scenario for using custom plugin.