Microsoft Dynamics 365 Blog

A look into the world of Microsoft Dynamics.

How to Create a Plugin for Dynamics 365

Posted by Alanna Friedberg on Jun 3, 2025 9:00:00 AM

How-to-Create-a-Plugin-for-Dynamics-365While Dynamics 365 provides organizations with various ready-to-use business features, your company may have a business scenario that requires something more customized. For that reason, Microsoft made it possible for developers to create Dynamics 365 plugins to handle those situations. We’re going to walk you through the basics of  how to create a plugin for Dynamics 365.

What is a Plugin?

Plugins are code libraries built by developers when they need to implement customized logic. For example, they can create a plugin specifically for handling accounting processes that aren’t part of the core functionality within Dynamics 365 Finance. After mastering the basics, developers can eventually develop plugins for any Dynamics 365 module.

A Dynamics 365 plugin is ideal for tailoring the platform to fit unique organizational needs. The Dynamics plugins help businesses extend the platform’s functionality beyond out-of-the-box features. Dynamics 365 plugin development allows organizations to build tailored solutions that support specific operational workflows and business logic.

By using plugins, organizations can optimize Dynamics 365 to fit their core business needs. Implementing a Dynamics 365 plugin can simplify workflows, reduce manual tasks, and improve overall efficiency. With proper Dynamics 365 plugin development, companies can create seamless integrations that enhance user experience and boost productivity. Those little extras go a long way toward making the application more accessible to workers. The more comfortable they feel within the platform, the more likely they will be to take full advantage of the platform’s available features.

When Should I Use a Plugin?

First, you should understand the difference between a plugin and a workflow. Workflows can trigger limited events, while plugins can handle a lot more. In addition, plugins actively extend the current behavior of Microsoft Dynamics 365 components. Some examples of when you might want to use a plugin include:

  • Needing business logic that updates specific fields in a record when creating or updating information using a Dynamics 365 application. 
  • Wanting to call external web services or other events that call for saving or deleting a record.
  • Needing to perform dynamic calculations on field values when a user opens a record.
  • Wanting to automate certain processes like sending emails to customers whenever someone triggers a specific event within your CRM.
You can create a plugin in Dynamics 365 to meet these specific requirements and improve automation. Dynamics 365 plugin development allows businesses to go beyond default capabilities and tailor solutions for complex scenarios. It ensures that your CRM system can meet highly specific functional needs.

Creating a Dynamics 365 Plugin with Dynamics 365

Before you get started, you will need access to an integrated development environment (IDE) that lets you write your new plugin using a .Net language like C# or Visual Basic. A class library in the .Net environment gets compiled into a dynamic link library (DLL) file that you must register with your company’s Dynamics 365 instance. With the right tools and planning, Dynamics 365 plugin development can significantly enhance how your CRM performs business logic and automation. A Dynamics CRM plugin can help automate workflows and extend the functionality of your system to meet unique business requirements. Additionally, creating a Dynamics 365 custom workflow can further improve process automation and business efficiency.

When you create a plugin in Dynamics 365, you’re building a powerful extension that allows the system to respond to specific events and execute business logic automatically. It’s a critical step in tailoring Dynamics to your organization’s unique processes.

You can download a Visual Studio instance and the .Net framework from the official Microsoft website. Dynamics 365 supports code built using a version of the .Net framework that is 4.6.2 or later. Developers can also find resources for building and extending Dynamics 365 applications here.

Once everything is ready, you can start creating a Dynamics 365 plugin. Learning how to create a plugin in Dynamics 365 enables developers to deliver targeted functionality that enhances business performance and streamlines operations.  Note, we’ll be referencing the C# language for this example, but feel free to swap in comparable libraries if you decide to go with a different language.

  1. Start your instance of Visual Studio, then create a new Class Library project using the .Net framework. Look for the latest version available. Again, make sure it’s at least 4.6.2 or higher.
  2. Enter a name for the assembly you’re building in the Name textbox.
  3. Go to Solution Explorer. Right-click on the project, wait for the context menu to appear, then choose the Manage NuGet Packages… option.
  4. Choose Browse, then enter the search term, “Microsoft.CrmSdk.CoreAssemblies.” Once it pops up, install the most recent version available.
  5. Make sure you click on “I Accept” when the License Acceptance dialog appears.
  6. Once the installation completes, go back to Solution Explorer. Click on the “Class1.cs” file, then select Rename from the menu.
  7. Change the name of “Class1.cs” to something that more closely matches the intent of your plugin.
  8. You should receive a pop-up that asks you if you wish to rename the class in your project to match your new file name. Select “Yes” to allow the update.

Now that you’ve created your project, you can edit your .cs file to implement the required business logic for your new library. Once you’re done, you’ll need to compile the assembly by hitting the F6 key. Once it compiles without errors, you must sign the plugin. The compiled Dynamics 365 plugin assembly is then ready for deployment to your CRM environment.

  1. Go back to Solution Explorer, then right-click on your plugin project. Select Properties from the context menu.
  2. Select the Signing tab from your project properties, then click the Sign the assembly checkbox.
  3. Go to the Choose a strong name key file dropdown and select New.
  4. Enter text for the key file name, look for the Protect my key file with a password checkbox, and make sure it’s unchecked.
  5. Select OK.
  6. Go to the project properties Build tab and verify that the project’s Configuration is set to Debug.
  7. Hit the F6 key once again to rebuild your plugin.
  8. Go to Windows Explorer and look for the following path for your newly built project: \bin\Debug\BasicPlugin.dll.

Make sure you change your build version to release when you’re ready to include the plugin with your solution. Next, you’ll learn how to register a plugin in Dynamics 365.

Registering a Plugin in Dynamics 365

  1. Download the Plugin registration tool using NuGet or PowerShell, then open it by clicking PluginRegistration.exe.
  2. Connect to your instance by selecting Create new Connection. Make sure you have office 365 selected.
  3. Enter your Microsoft Account credentials, then click Login. If you're using a Microsoft account different from the one currently signed in, click 'Show Advanced' and enter the appropriate credentials. Otherwise, keep 'Sign in as current user selected. 
  4. Note that if your account provides access to multiple environments, you’ll need to pick the correct one. This can be done by following the steps below:
    1. Click Display list of available organizations.
    2. Click Login.
    3. Choose the organization you want to connect to and click Login again.
    4. Once connected, you'll be able to view any registered plug-ins, custom workflow activities, and data providers.
  5. Once you connect, you should see any existing plugins and workflow activities registered previously.

Now that you’ve accessed the right environment, you can register your new assembly. The plugin registration tool in Dynamics 365 simplifies the process of registering and managing custom plugins within your environment.

  1. Go to the Register drop-down and select the New Assembly option.
  2. Click the (…) ellipses button that appears in the Register New Assembly dialog, then look for the assembly you built in the section that went over how to create a plugin for Dynamics 365.
  3. If you’re using Microsoft 365, make sure that you have isolation mode set to sandbox and Database selected for storing the assembly.
  4. Next, click on Register Selected Plug-ins. You should see a confirmation dialog appear.
  5. Click the OK button to close that dialog and the Register New Assembly dialog. The new assembly should now appear.

Once you’ve gotten the hang of how to register a plugin in Dynamics 365, you should look into how to debug a plugin in Dynamics 365 to ensure functionality.

Make the Most of Your Dynamics 365 Instance

Integrated eBusiness Solutions (IES) gives companies what they need to optimize business tools to maximize efficiency within their organization. Dynamics 365 plugin development is one of the advanced services we offer to customize your CRM for unique business needs.  Learn more about how we can help you take advantage of all Dynamics 365 features by setting up a consultation. By leveraging Dynamics CRM plugins, we can help you extend your CRM's capabilities and automate complex business processes. Learn more about how we can help you take advantage of all Dynamics 365 features by setting up a consultation.

FAQs

What is a plugin in Microsoft Dynamics 365?
A plugin in Microsoft Dynamics 365 is custom code that runs when certain actions happen, like creating or updating a record. It helps you add extra functionality beyond what’s built in.
How do I create a custom plugin in Dynamics 365?
To create a custom plugin in Dynamics 365, you’ll need to write code using a .NET language like C# or Visual Basic. The code is compiled into a DLL file, which you then register in your Dynamics 365 instance to make it work. Once you create a plugin in Dynamics 365, you can tailor it to suit your specific business processes and integrate seamlessly with your CRM system.
How do I debug a plugin in Dynamics 365?
To debug a plugin in Dynamics 365, you can use Visual Studio to set breakpoints in your code. You’ll need to attach the debugger to the Microsoft Dynamics 365 process to step through the plugin’s execution and check for issues.
What is the plugin pipeline in Dynamics 365?
The plugin pipeline in Dynamics 365 is a series of steps that execute when a plugin is triggered. It processes the plugin code in a specific order, handling different stages like pre-validation, pre-operation, and post-operation, allowing you to modify or interact with data before or after certain actions within Dynamics 365.
Can I use a plugin to automate processes in Dynamics CRM?
Yes, you can use a plugin to automate processes in Dynamics CRM. Plugins allow you to add custom business logic, automate tasks like updating records, sending emails, or calling external services, and extend CRM functionality to meet your specific needs.

 

Top 5 Hidden Features of Dynamics 365 Business Central

Topics: Dynamics 365