DYNAMICS 365 RAISE ERROR IN PLUGIN

To raise an error in the plugin code, we use InvalidPluginExecutionException. For example: throw new InvalidPluginExecutionException("Plugin has run. Code will stop executing."); The code runs in the Execute function of the plugin code. For example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; namespace Carl.AssociateDisassociate {      public class AssociateDisassociate : IPlugin { public void Execute(IServiceProvider serviceProvider)         {             throw new InvalidPluginExecutionException("Plugin has run. Code will stop executing.");          }     }} The code will display the error and stop executing: If you … Continue reading DYNAMICS 365 RAISE ERROR IN PLUGIN

CREATING AND DEBUGGING A PLUGIN IN DYNAMICS CRM

The Dynamics CRM 2016 SDK contains a plugin sample. The code is located here: SDK\SampleCode\CS\Plug-ins\AccountNumberPlugin.cs I’m going to go through step by step how to create this plugin and upload it to Dynamics CRM, then how to debug the plugin. In the example I will connect to a Dynamics CRM 2016 Online instance. Firstly, open and build the … Continue reading CREATING AND DEBUGGING A PLUGIN IN DYNAMICS CRM

CREATING A DYNAMICS CRM PLUGIN FROM SCRATCH

Here I will go through an example of creating a Dynamics CRM plugin. In this example, I will create a plugin to set the opportunity description after the opportunity has been created. First create a new project in Visual Studio. Next, add references. Add the Microsoft.Xrm.Sdk.dll which is found in the CRM SDK at CRM SDK 2016\SDK\Bin … Continue reading CREATING A DYNAMICS CRM PLUGIN FROM SCRATCH