Wednesday, March 12, 2014

Cross-stage workflows for beginners. Part I. SharePoint Designer


Hello!
One of the most important things in SharePoint 2013 is cross-stage workflows. SharePoint 2010 has "sequential" chain-like workflows with plain passage in flow. Sequential workflows pass through the flow from start point to end point with executing a defined set of activities. This is restricting your vision of any workflow in your organization. Let me show you how you can implement workflow with a complex business logic.

Tuesday, January 14, 2014

Code Activity Assembly Cache Updating

How to develop code activities for the Workflow Manager you can for example read here.
When you have developed the second version of your activity you need to update activity DLL cache. Otherwise, the old version will execute in your workflow. Let's see how to do it.

Tuesday, October 22, 2013

Build Collections for Composite Task


For a Composite Task you need to define executors and set AssignedTo field. This field has a specific type InArgument<Collection<string>>. So you need to build a collection of strings and specify it to Composite Task activity. Let's take a look.


Tuesday, August 6, 2013

Start SharePoint 2013 Workflow Programmatically

If you want to start workflow from server-side code, you need to use Microsoft.SharePoint.WorkflowServicesBase DLL.
If you don't see it in reference search, you can find it in GAC C:\Windows\Assembly with standard windows explorer search (of course if you have installed Workflow Manager).
And then to start a workflow:

 protected void StartWorkflow(SPWeb web, Guid workflowID, int itemID)  
 {  
   var wfsrvmng = new Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager(web);  
   var wfsubsrv = wfsrvmng.GetWorkflowSubscriptionService();  
   var wfsub = wfsubsrv.GetSubscription(workflowID);  
   var wfi = wfsrvmng.GetWorkflowInstanceService();  
   wfi.StartWorkflowOnListItem(wfsub, itemID, new Dictionary<string, object>());  
 }  

where workflowID you can find in the workflow Elements.xml

 <Property Name="WSGUID" Value="..." />  

Wednesday, July 31, 2013

Update Lookup Field in the List Item in Visual Studio Workflow

When you want to update lookup column in your list item, you need to use UpdateListItem activity especially.
For example, your column has static name "MyColumn". Then you need to set path "MyColumnId" to id of the lookup value item (your Int32 variable):

Sunday, July 28, 2013

Lookup Activities in Visual Studio 2012

When you develop a workflow in VS 2012 you probably want to work with other lists of your SPWeb, not only the current list either the task list. But you may get this error:

 System.FormatException: Expected hex 0x in "{0}".   

Problem is that substitution "$ListId:Lists/MyList" doesn't work in flow scope.