one of my favourite CRM bloggers Jamie Miley wrote a very interesting article today – How to execute a workflow from .NET and Jscript.
Jamie is always a big fan of doing anything in Jscript but I prefer the .NET approach. You should read the article above to see both the .NET and Jscript examples and Jamie explains what’s going on and how it works.
Basically you need to instantiate a service object, which you can get pretty easily if you are in a plugin and then you can execute a workflow. You will need the Guid of the workflow and the guid of the entity you want the workflow to run against.
ExecuteWorkflowRequest req = new ExecuteWorkflowRequest();
//specify the guid of the
workflow req.WorkflowId = new Guid("D009C04F-F826-4B3B-90CD-209581CFC2FF");
//specify the guid of the related entity instance
req.EntityId = new Guid("A46FA1C1-E38D-E011-86BA-1CC1DEE8EA49");
ExecuteWorkflowResponse resp = (ExecuteWorkflowResponse)slos.Execute(req);excellent blog post