Tech N Toast®

Plug-ins in Microsoft Dynamics 365 (CRM)

Plug-ins in Microsoft Dynamics 365 CRM

It is working perfectly fine for your normal tasks like creating records, generating leads, dashboards etc. But, the real problem starts when you have to modify the normal behavior of the system. You want to extend it for some specific scenarios. In this situation, you can use a business logic that can be customized to meet your specific demands -

1. You want that the system should automatically send emails to your customers on certain occasions.
2. You want that some fields or records should be automatically updated in CRM. 
3. You want to automate some internal tasks for some specific queues or users.
4. You want to call an external web service while creating or updating a record.

You will find lots of occasions where it becomes absolute necessary for you to use a Plugin-in, which is a custom code. .NET platform is used to write and compile it.

Read my technical book - Creating a plug-in for Microsoft Dynamics 365 CRM

There are a number of ways to automate your tasks - 

1. Plug-in - It is a .NET program, which is used to perform complex tasks, triggered to perform the desired tasks when a CRM record is created or updated. You can use C# or VB.NET to write plug-ins. We mostly use C# (C Sharp) language. You can use any, but it is very important to add two assembly references - 1. Microsoft.Xrm.Sdk.dll 2. Microsoft.Crm.Sdk.Proxy.dll

2. Workflows - Automate various tasks that do not require human interaction. For example, you can use Workflows to automatically send emails to customers, which is a straightforward process in Microsoft Dynamics 365. The Workflows run in the background once triggered. 

3. JavaScript - You can use JavaScript to hide or unhide some specific fields. This tool is useful if you want to hide some sensitive information. For example, you don't want one particular team or user to access bank details, mobile numbers etc. 

There are two types of Plug-ins -

1. Synchronous - If Synchronous plug-in triggers on the creation of a lead. The lead form will not be saved until the plug-in is in progress. The CRM form waits until the plug-in finishes the execution. This works well if you want that the next step should be immediately completed after the first step. You want that the account number should be immediately created while creating the account or when the account is created.   

2. Asynchronous - These plug-ins are queued by the Asynchronous Queue Agent, and executed by the Asynchronous service. The plug-ins run in the background. They don't affect your current tasks. They run independently. For example, you are saving or creating new records, you will not receive any interference from the Asynchronous plug-ins. That's why they are not good when you want to perform some data validations.

How Plugins work in Dynamics 365 CRM

Synchronous and Asynchronous are quite common terms in dynamics 365. You will always hear or see Synchronous plug-ins/workflows and Asynchronous plug-ins/workflows. Let's talk about them a bit more -

Synchronous - This type of plug-in/workflow says "Do not take the next step until you complete the current task, or do not start the next operation until you finish the current operation". For example, you have got two things to eat - bread and butter. You start eating the bread, and the Synchronous Plug-in is triggered. Now, you cannot start eating the butter until the bread is finished.

Asynchronous - This type of plug-in/workflow says " I don't care what's happening on the screen, I will run in the background. You can do whatever you want to do. I will finish my operation without affecting your work". For example, you have got two things to eat - bread and butter. You start eating the bread, and the Asynchronous Plug-in is triggered. Now, you have got lots of choices. You can start eating the butter, or you can get something else to eat. The Asynchronous Plug-in will finish the bread by a background task.

Event Execution Pipeline - Decide when you want to execute the Plug-in code. For example, you want to use "Create” Plug-in -

1. Pre-Validation - You just validate the record. You do not create or save anything in this stage.

2. Pre-Operation - You can add or modify the information, which was available in the Pre-Validation Stage. The record is not created, yet.

3. Post-Operation - The record is successfully created in the system. Now, you cannot modify the record.


Plug-in Messages -

You will find lots of triggers or Messages like Assign, Create, GrantAccess, ModifyAccess, Delete etc. to trigger the execution.

For example, It is triggered 

1. Create - when the record is created. 

2. Delete - when the record is deleted.

3. Update - when the record is updated.

4. Retrieve - when the record is retrieved.


How to disable it in Microsoft Dynamics 365: 

You have created a Plug-in. Now, you want to stop it from triggering. It is very easy. You do not need to seek any assistance. Let's learn how to do it.

1. Go to Settings > Customizations > Customize the System > On the left navigation pane, click SDK Message Processing Steps > Select the Plug-in that you want to disable > Click Deactivate > Publish all customizations.

View Plugins in Dynamics 365 CRM




No comments:
Post a Comment