Plugins Workflows and Jscript

Written By: Josh Behl

from July 9, 2013

The terms “Plug-In,” “Workflow,” and “JScript” are commonplace for those who are experienced with Microsoft Dynamics CRM. Sometimes, it seems that even users who have a number of years of background using the product do not always understand the difference between these terms. This article brings some clarity for those who are unsure or find the terms confusing.

Workflow

A workflow is merely an automation of a business process. It is a business process of some kind that occurs when a specific action is taken on a type of record.

For example, every time someone is assigned a lead, an email is received telling them they have been assigned a lead as well as some details about the lead. Think of it as a process where an event of some kind occurs, the application recognizes that event, and then takes action on that event. This is a simple example; however, these automations can certainly range from the simple to the moderately complex.

Within Microsoft Dynamics CRM, there is a tool which allows for the creation of these automations. Within the product, the workflow functionality is part of an all-encompassing suite of automation tools referred to as “Processes.” Within the Process area is also the ability to create a “Dialog.” A dialog is like a workflow in that it is designed to automate some kind of business process. However, where a workflow will run behind the scenes, a dialog will prompt the user to answer questions about the process as the automation takes place. Think of it as a “wizard” much like is used when installing a piece of software.  A dialog is the same conceptual thing. The nice thing about workflows and dialogs is they do not require a developer background and can be created, updated, and used directly within the interface.

Plug-In

A plug-in, like a workflow, is also an automation of some kind of business process or logic. The biggest difference is that it is 100% code.

Non-developers will not be writing a plug-in anytime soon. A plug-in is a .NET assembly (which is like a big chunk of code packaged together) that is essentially injected into the Microsoft Dynamics CRM platform. When it is injected into the platform, the developer will indicate what entity it will be triggered upon and what event will trigger it.

The nice thing about plug-ins is they essentially provide almost total flexibility in regards to automating processes or incorporating business logic into the application. A workflow has limitations to what events and even entities it can leverage. A plug-in, on the other hand, provides total flexibility in that sense. Anything that can be done with a workflow can be done with a plug-in.  But most things that can be done in a plug-in cannot be done in a workflow. However, there is a convenient user interface to create workflows but for plug-ins there is not.

Jscript

A JScript has a couple of synonyms that may help put it into a better context: “Java Script” and “Client Side Script.”

JScript is essentially Java Script – it is just the Microsoft implementation of Java Script (there are differences of course, but for the most part they could be considered the same thing if you are not a developer). These are snippets of code that can be added to a number of events in the application such as changing of a field on the form (this is called the ‘OnChange’ event), saving of a record from the form (this is referred to as the onSave event), and when the form loads on the screen (this is the OnLoad event).

In most cases, a developer does this but it is much easier for the non-developer Microsoft Dynamics CRM administrator to include this kind of code into the application. Code examples from many resources can be leveraged and put in the correct places within the application. Once tested and published, it is ready to go. This is a bit of a simplification, but accurate.

One key thing to take away from this description is the fact that these scripts are placed on the form and will trigger as the user is interacting with the record. Unlike plug-ins, these scripts will only run when the user has the form open and is active within it. A plug-in will trigger and run logic regardless of how the event is triggered (e.g.: data migrations, other workflows, direct user input and updating of records, and so on). Also, for the JScripts to run, the fields they interact with must be on the form. This script is looking directly at what the user has on the screen. If the “thing” the code is looking for is not on the screen/ on the form, the code cannot see it and as such cannot perform that business logic.

For developers, this article oversimplifies much and that was purposeful. It is often easy to forget that customers and users do not speak the same “CRM Lingo” language that is often used among developers and administrators. For more information about all of these concepts, check out the online Microsoft Dynamics CRM SDK http://msdn.microsoft.com/en-us/library/hh547453.aspx and on Dynamics University blog

By Josh Behl, Summit Group Software