With the CRM 4.0 enhancements to the plug-in and workflow engine as well as the introduction of the web based workflow designer I've seen many CRM developers asking the same question: When should I use workflow vs. plug-ins?   The answer is “depends”; the right approach is determined by the characteristics of the task that you are trying to accomplish.  The following matrix gives you my take on this:

Requirement

Plug-in

Workflow

Needs a synchronous action to happen before or after an event occurs

x

 

The same piece of logic will be executed for different events and possibly on different entities

x

x

The logic needs to be executed while offline

x

 

Needs elevation of privileges (impersonation)

x

 

Needs to execute on events other than assign, create, update, setstate

x

 

The process/logic may take a long time to complete or will be a persistent process (multiple long running steps)

 

x

Needs an asynchronous action

x

x

End users will need to modify the process logic

 

x

Child sub processes will be triggered

 

x

It may also be the case that a combination of both approaches is required; a plug-in can trigger a workflow and a vice versa.  From the above matrix the most decisive factor is whether you need a synchronous action or not; if you do, plug-ins are the way to go, if you don’t then other factors need to be pondered.