After writing the plugin and signing it, open Plugin registration tool.
1. Create connection either with Online or Office 365 Microsoft Dynamics CRM account.
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.
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.
4. Before debugging, select the step that you want to perform action against and select start profiling, a Profiler Setting dialog box will open.
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.
f. Now in Plugin registration tool select debug, this will open a, Replay Plugin Execution dialog.
g. Click the down arrow mark to open the plugin profiles that were saved in CRM.
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.
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.