Posted in CRM, Plugin

HOW TO DEBUG MICROSOFT DYNAMICS CRM ONLINE PLUGIN 2016

Microsoft Dynamics CRM Online Plugin Debugging

After writing the plugin and signing it, open Plugin registration tool.
1. Create connection either with Online or Office 365 Microsoft Dynamics CRM account.

login-page2.png

2. Register a new Assembly, when registering a plugin for Online Microsoft Dynamics CRM, Isolation mode has to be Sandbox and storage location has to be Database for Online plugin.

register-assembly.png

a. Microsoft Dynamics CRM collects run-time statistics and monitors plug-ins and custom workflow activities that execute in the sandbox. If the sandbox worker process that hosts this custom code exceeds threshold CPU, memory, or handle limits or is otherwise unresponsive, that process will be killed by the platform. At that point any currently executing plug-in or custom workflow activity in that worker process will fail with exceptions.
b. Sandboxed plugin is recommended when execution needs to be more secure, supports runtime monitoring and statistics reporting.
c. Plugin registered in sandbox mode will be having full access to the MS CRM SDK to access the organization web service.
3. If you haven’t installed Plugin Profiler, in the toolbar, select Install Profiler on selected organization, this will create a solution in the selected organization consisting of an entity Plug-in Profiles.

install-plugin-profiler.png

4. Before debugging, select the step that you want to perform action against and select start profiling, a Profiler Setting dialog box will open.

profiler-settings.png

i. Profile storage as Exception
a. If you have selected Exception Option in the Profiler Setting Dialog box, when you perform action in CRM, a Business process Error Dialog is displayed, download this log file and save the file.
b. Later, Open your Solution in Visual Studio, debug the plugin by attaching PluginRegistration.exe
c. Now Click debug on Plugin registration tool, Replay Plugin Execution dialog will open. Select Error Log file as profile and provide the dll file location in Assembly location and provide the plugin details then click start execution.
d. Now you can debug the code in Visual studio.
ii. Profile Storage as Persist to Entity
e. Perform the action in CRM that will trigger your plugin. This will create a Plugin profile in the entity Plug-in Profiles that we have already discussed.

plugin-profiles.png

f. Now in Plugin registration tool select debug, this will open a, Replay Plugin Execution dialog.

plugin-profiles1

g. Click the down arrow mark to open the plugin profiles that were saved in CRM.

plugin-profiles2.png

h. Select the appropriate Plugin Profile and also select Assembly location and the appropriate plugin on the Replay Plugin Execution dialog box.
i. Before Starting the Execution note down the Plugin Registration process ID that has been highlighted like below.

plugin-profiles3.png

j. Now Open Visual Studio and debug the code attaching the process ID that is displayed on the dialog box.
k. Then Click Start Execution on the dialog box to start debugging.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s