Author: Ayushman Bajracharya
Want to learn how you can create a custom plugin in Dynamics 365? Let’s get started!
The Tools that we will be using here is Visual Studio 2017
Step 1: Open Visual Studio, search for D365 developer extensions from Tools> Extensions & Updates and install as shown in Figure below.
As we have already installed so it’s giving you the option to disable or uninstall, else there will be an option to install.
Step 2: Next create a new project, in the dialog box, on left pane, choose D365 DevEx , which will show different types of project you can install for Dynamics 365. Select CRM/365 Plug-in Project from the list as show in the figure below.
Step 3: Give a name to the project and select ok. This will prompt to select the version of Dynamics 365 for which this plugin will be deployed to. Select the version of your Dynamics 365. Here we will be deploying to the latest version which is 184.108.40.206. See the figure below:
This will create an empty project with all necessary dependencies.
Step 4: Next, we need to add a new plugin class. As before while creating new class you can select CRM/365 Plug-in class from add a new item list as shown in this figure.
Step 5: Now you can write your code here to update or create entity based on the requirement. We will be showing how to update a custom field company name in account when new account is created .Here the entity variable will give you the entity in which you deploy the plugin, for e.g. if you deploy it for the account, it will contain account entity. We will write a separate tutorial for deploying the plugin. For now, let’s assume it will be deployed for account.
In this sample we are taking account name and assigning it to company name field the same value and updating the entity.
That’s how you create a plugin to update a field. You can also create a new record with service create method. In the next section we will be showing how to deploy trigger this plugin in Dynamics 365 for account entity.
If you would like to take advantage of the latest updates on CRM, ERP and other technologies within your organisation, Contact us today for a no-obligation consultation on 01296 328 689. Or email us at firstname.lastname@example.org.