Comparison: Using Workflows vs. JavaScript vs. Plugins in Dynamics CRM

There are three ways to automate actions in Microsoft Dynamics CRM: workflows, JavaScript, or plugins. In this blog we will discuss the difference between them and how to choose which option is appropriate for your task.

So, how do you decide using workflows vs. JavaScript vs. plugins when so there are many ways to update the information you want? There are a few factors to help the decision:

Here is a table that will help you identified the difference between workflows, JavaScript, and plugins for use within Microsoft CRM.

Workflow JavaScript Plugin
Synchronous Asynchronous Synchronous Either
Can Get External Data No Yes Yes
Maintenance Business Users Programmers Programmers
Can Run As User User CRM System
On Demand Yes No No
Nested Child Process Yes No Yes
Executed After Saving After Before After
Triggers Create, Field Change, Status Change, Assign to Owner, On Demand Field change or Form Load Create, Field Change, Status Change, Assign to Owner, Delete

For different cases when the user may need to walk through a process and make decisions, dialogs may instead be the right answer. To help make that decision, our blog on CRM Workflows and Dialogs: What's the Difference?  provides great comparison.

Happy CRM'ing!

Plugin Unsecure Configurations Made Easy

One of the more common use cases in Microsoft Dynamics 365 tends to be writing plugins and needing to pass parameters that the plugin code can use.

The traditional format to pass parameters has been XML that is pasted in the unsecure configuration. Parsing XML tends to be cumbersome and one ends up writing more code and spends more time maintaining that code rather than focusing on the business logic within the plugin. The question is: can we do any better?

Yes, there is a better way! The following process is what we tend to use to simplify this task:

Step 1

Build a class that contains the variables that you want to pass in through the unsecure configuration.

For the purposes of our example, our class definition looks like the screenshot below.


Step 2

Instantiate the object and serialize it. You could use JSON.NET or write your own. In either case, the serialized output will be similar to below.


Step 3

Paste the JSON in the unsecure config of your plugin step.


Step 4

In your plugin code, deserialize the JSON as follows

Code for the Deserialize method is below.


Sample code for the JsonHelper class was derived from this Microsoft article.

Step 5

Now you are free to use variables defined within the reserialized object as you need in your plugin code. Mission accomplished!

For additional information, check out the following blogs:

Comparison: Using Workflows vs. JavaScript vs. Plugins in Dynamics 365

Setting Output Parameters in Plugins for Custom Actions

Happy Dynamics 365'ing!