Registering Plugin Processing Steps

I was wracking my brain the trying to figure out why my plugins were not being deployed as part of my solution between different tenants.

A closer look yielded the answer, that the plugin itself was being deployed but not the messages themselves.

To do this, you need to add in the SDK Processing Steps separately and then deploy your plugin.

blog.PNG

Which really begs the question, when would you ever deploy an empty plugin assembly without the steps you already validated in a test tenant only to now deploy to Production?

A better solution to the above problem would be for the solution window to prompt you, asking if you want to add these already preconfigured messages to your solution (a la dependency components when adding entities).

 

Debugging Dynamics Plugins

Plugins have been around a long time in Dynamics and you either love them or strongly dislike them.

There isn’t much in between.

In working through a few issues on a recent project I had to build a plugin to tap into some many-2-many relationship joins.

If you are looking to solve a similar problem here are some links to get your started.

https://community.dynamics.com/crm/b/mscrmshop/archive/2012/05/14/how-to-trigger-a-plugin-for-many-to-many-relationship

https://community.dynamics.com/crm/b/mylifemicrosoftdynamiccrm/archive/2017/04/09/ms-dynamics-crm-associate-disassociate-message-plugin

In working on this problem I had to do a little more debugging in my plugins and was surprised to see the changes that have come in the Plugin Registration Tool.

To walk through your plugin’s execution, follow these steps.

  • Register your plugin.
  • If you have not already done it, Install the Plugin Profiler from the Plugin Registration Tool.
  • Before going back to Dynamics, Start the Plugin Profiler.

plug

  • Select your profile storage method (I left as recommended).
  • Now validate your code in Dynamics.  Upon completion you will be prompted with a file to download, save it.plug4
  • Now click on the “Replay Plug-In Execution” button at the top of the plugin tool.  The following window will appear where you will associate your downloaded plugin file and plugin.  Also note, that the tool tells you what PID (Process Id) the system is running as which will allow you to attach your Visual Studio process to, to walk through your code.

plug44

When you are ready, click “Start Execution”.

  • When executing you will see output akin to the following (where in my case the name of my plugin is called RecipientHandler.

plug444

This is a much easier, straight-forward and simpler way to debug plugins.  The step-through is great as you can then configure breakpoints in your code to see what Input/Output parameters you are working with and eliminate much of the guesswork.