Debugging a sandboxed plugin in CRM 2013 online may appear just a little obscure initially but not deny that it would be really life saver. Maybe you’ve given up the idea and instead decided to do something which i call poor man’s debugging – throwing InvalidPluginExecutionExceptions everywhere and hoping to find a remedy? I admit, I i did so that many too but this is merely wrong. Throwing exceptions is not just a solution for debugging, it is solution for handling exceptions and should stay that way. In this website post I’m teaching you, detail by detail, how you can debug a plugin in CRM and save plenty of commitment in the foreseeable future.
First we go through what you’ll need. You probably own all necessary components because you are a CRM programmer already. Then I explain an example scenario that I’m using while going right through this debuggin process. You might now close all other tabs in your web browser. This website post contains all you have to to be able to debug a plugin in CRM Online.
Let’s pretend we are creating a plugin that has to generate a contact address for a contact. We’ve created a plugin which will be fired always when a contact is created or updated (running a plugin on every revise is not preferred in this case but just play along). Both steps are authorized on pre-operation stage of execution.
- Advertising in your area
- How will she spend her weekends and holidays
- Communicate with People You Share Your Home With
- Not TOGETHER WITH YOUR Address
Below is my plugin code. Remember that I’ve divided some of the normal plugin reasoning to its class (Plugin.cs) which we are inheriting inside our real plugin. Then we assign that new email string to entity’s emailaddress1 property. Since this is a pre-operation plugin we don’t have to call upgrade.
This plugin works well on create because full name is business required field. Well we all know the reason already, but let’s pretend we don’t. Open your plugin registration tool. While plugin enrollment opened up you want to set up something called a profiler. All you need to do is to press “Install Profiler” and await a moment.
When the profiler is installed (when you see “Profiler Installed Succesfully”) press Ok. Note: This (profiler) creates a new managed solution to CRM. As I used to be writing this tutorial something strange happened (CRM happened) and my plugin registration tool lost a connection to CRM. I wasn’t able to connect CRM for a little moment so I went and erased that managed solution from CRM personally. I have no idea if it was only coincidence or if it actually helped but everything worked normally after that.
So that’s something to keep in mind for sure! Choose a plugin and a plugin step you want to debug. As described in the situation our plugin is crashing on update event. So you want to debug our plugin on update step / event. Create profiler settings. You might like to leave them because they are.
Press OK when ready. Once you’ve started the profiler you have to improve a meeting that will flame the plugin. In our case which means we must update an existing contact. I’m upgrading Fernando Alonso’s job title to 1st driver which will increase an update event but will also crash our plugin (well, you understand the trend is to). When that happens a profiler gives us a log file that we have to download and store locally for further use. Download the log document and then close business process error popup by pressing ok. Get back to your plugin registration tool and press debug. Replay Plug-in Execution popup opens on the screen.