SharePoint Server 2013 Workflows


Published on

Speakers: Saša Tomičić, Ivan Popek;

This session will introduce an interesting set of new features and capabilities of the SharePoint Server 2013 workflow engine powered by .NET Framework 4.5. We will show which platforms you can use to develop your workflows and show the SharePoint Designer workflow enhancements. Beside that you will see new Windows Azure Workflow capabilities and, last but not least, a few Windows PowerShell cmdlets that manage workflow.

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Until now you have had a chance to see many new Office and SharePoint features, among them are new Apps and Cloud App Model or new Office and SharePoint store. Also, both SharePoint client and server object model have been improved.However, major area we are interested in is workflow. Workflow is now offloaded of the SharePoint server and it’s running within the workflow manager, already known as windows azure workflow. This allows you to scale your workflow, just like with apps in cloud. Interaction with SharePoint server or any other external service is performed over open standards such as REST or HTTP.“Old” workflows are still valid, but use different workflow engine.
  • First of all, let’s see the overview of what has been accomplished with workflow. When Microsoft started to work on the 2013 workflows, they wanted to accomplish three major goals.First, they wanted to make declarative workflows inside SharePoint designer more expressive. Their idea was to provide additional features, that we as developers, can use before going to the Visual Studio. The best example for new features is new, richer flow control. Before, in many cases, we were unable to use SPD because we couldn’t implement our logic using provided flow control functionality. Also, if you have either current workflows or want to use some previously created custom actions, you will able to use and invoke them from new workflows without any problems.Second, as you already saw on other sessions, new cloud app model has been introduced. A lot of work have been done in order to ensure that workflow is aligned with the new app model. We have alignment of workflow in two ways. One, workflows are major component used to build apps in SharePoint because workflows provide declarative logic in your apps. The other thing is, workflow is also consumer of the app model. App model is actually used to build workflows in SharePoint. In just two words, workflows are now cloud ready.Finally, in the spirit of the new app model where solutions are moved from SharePoint to a more loosely coupled model, so then they can run both on premise and in the cloud, same adjustment has been done within workflow. The major consequence here is the fact that workflow processing and executing is now done outside the core SharePoint web server process.Expressive: Richer flow controlModular building blocksStages and transitions: a model for real-world processVisual Designer: facilitates collaboration between analyst and workflow designerObject model designed for extensibilityCustom workflow experiencesConnected: Cloud-readyCall REST web servicesComplex dataCustom actionsService-oriented REST based contractsPredictable execution and consistency modelUnbounded: Loosely coupled integration of Workflow Manager and SharePointManage and scale workflows independently of SharePointBetter transparency for workflow resource consumption
  • Let’s move to the architecture of the new workflow to see how are all those improvements implemented.We are know that everything in SharePoint is about people, content, sharing and in SharePoint 2007 introduced workflow engine. That workflow engine can execute either on a web front end where the page is rendered on in the timer service.In 2013 we have completely new server called workflow manager. This is the place where all running workflows are executed. Workflow manager has been built in a way it can process pure declarative workflows. Also, because it’s a separate server it can be scaled and managed independently so now we have much more control about where the workflow is executed. Another benefit of this is that web front end reduces resource requirements that would otherwise be required to process our workflows.Workflow manager uses some other components to run workflows and one of them is the service bus. Service bus is a messaging platform stolen from the azure. Typically, Microsoft moves services from servers to the cloud, but this is a rare example of the move in opposite way. Workflow uses service bus as a core state management and messaging layer. This is very important because with SharePoint and workflow manager located on separate servers, all communication is performed using messages.Connection between SharePoint and workflow manager goes through the additional component called workflowservices manager. Part of this component is workflow service application proxy used to establish connection between platforms. In order to establish a connection, a component called workflow client must be installed on each SharePoint box. This is the one and only component that still has to be on the SharePoint box. It is possible to put everything on the same machine, but if we separate them as recommended, workflow client is the minimum we have to keep on the SharePoint machine.There are also few additional services inside the workflow services manager responsible for interaction with apps, deployment, events handling and interoperability with old workflows.On the other side, workflow manager communicates with SharePoint by sending REST messages processed by the new REST object model.All communication is secured via oAuth security model.At the end there are two tools we can use to create new declarative workflows, first of all SharePoint designer and then Visual Studio.
  • In SharePoint we have various models to host our apps.First there are provider-hosted apps, which is when you host your app in your own hosting environment and then there are auto-hosted apps where Microsoft hosts your app for you in azure.There is also a third option you can see in Visual Studio and that are SharePoint-hosted apps in which your app is hosted on your server but still uses only core capabilities of SharePoint. However, this option provides less flexibility than cloud hosted apps. The idea of this approach is to use all the web elements of SharePoint for the UI (HTML, java script), but also to use workflows for the server side processing, implementation of the business rules or event based logic.OK, let’s move now towards tools and let’s find out a little bit more about them. First, we’ll quickly go over development of workflows using Visual Studio and then we’ll move to the SharePoint Designer and show one interesting demo using it. Ivan, would you be so kind and tell us few words about Visual Studio workflows?
  • Let’s talk about workflow development and the authoring experience when using Visual Studio 2012.First, we’ll have a look at where workflows fit within your apps, based on the type of hosting you are using.Then, we’ll see how the Visual Studio tooling has improved for this release and what data is actually deployed by our solution.And finally, we’ll take a brief look at the client-side object model we can use to interact with the Workflow Manager.
  • SP-Hosted apps: in this scenario, we can use WF as a middle-tier in our 3-tier application. It can implement our business logic because it knows how to send e-mail, create tasks, work with SP data (lists/libraries) and call into web services. So, the WF can get data from the data layer and relay it over to the UI layer. In this case, everything is contained within SharePointCloud-Hosted apps: add a bit more to the story. In this scenario, we can still use WF as a service; Now, our cloud-hosted app can call into WF, using the JavaScript OM, and interact with the WF, which can in turn either access SP data or access an external service.
  • What does declarative mean?First, it simply means “no code”Secondly, it means that we are authoring a solution by not explicitly specifying how to perform an action; instead, we are specifying what our action should be. This is why, when we talk in terms of SharePoint workflows, we talk about activities.Now, like we’ve already pointed out, the Workflow engine has been completely changed since the 2010 release, and we can now use the Windows Workflow Foundation designer inside Visual Studio 2012 to author our SharePoint 2013 workflows. Let’s have a look at this new designer right now…
  • When you want to talk to Workflow using the OM, we need to talk to the WF services manager for the specified site. Then, depending on what you want to do with WF, you ask the services manager to give you access to an instance of a specific service.For example, the deployment service can help you work with WF definitions, such as validating the workflow XAML etc.The instance service gives you access to running workflow instances. So, if you’d like to send an event to a workflow that’s already running, this is the service to use.Then, there’s the subscription service, which handles WF associations. That is, which resource is our WF associated with and how is it triggered?The messaging service provides the infrastructure that enables SharePoint and WF manager to communicate.And finally, there’s the interop service, which you can use to call into SharePoint 2010 workflows. So, if you are still using SP2010 workflows, you don’t have the time or resources to rewrite them, you can still use those, through the interop service.Suppose you have a piece of XAML that defines the workflow… let’s see how you could validate it using the described object model.
  • Now I’ll talk a little bit about the other available development tool, and that’s SPD. First, we’ll check what is new in the 2013 version.First thing, workflow infrastructure. This is not only about the workflow backend, but also about the concept of stages which is now incorporated directly inside the workflows. Other improvements are in the area of scalability and the way we can create our own custom actions which is lot easier now.Next, workflow designer get improved as well with the text based designer from before expanded by the new visual design surface.Finally, there are many new and a set of old, but improved, workflow actions.
  • Let’s see those new features. There are really many new features and this list does not contain all of them, but the most important features are in it.New Visual Designer!Stages – instead using linear workflows, now we can better follow the business process by using stages.Ability to call external web services.Copy/paste actions from both designers!Looping – two different ways; looping between stages or you can use two new looping options.Dictionary variables – great way to save web service data, but also for the arrays.Tasks – two actions, one that creates simple task and other that creates complex processes.WSP portability from site to site, for any workflow type.Support for 2010 workflows!
  • New App-Step that executes actions at the app level. That means you can give your app permissions that are distinct from the initiator.Parallel block – improved.Integration with project server.Overall there are 50 new or improved features.
  • To use workflow manager you have to install it. You can do it either from the web platform installer or directly from the download center.If you use web platform installer and search for workflow, you’ll get three results – Workflow Manager, Workflow Manager Client and Workflow Manager Tools for Visual Studio.You have to download first two, ensure client get installed on the every machine where SharePoint is and then run the PowerShell pairing command that binds your workflow manager with the SharePoint environment.Here I have one additional note. First, in production, it is required to used SSL and that’s the requirement of the oAuth protocol. For development, you can set additional switch which will enable http protocol.Ivan, can you tell us a bit more about issues you hit while configuring our development box?
  • SharePoint Server 2013 Workflows

    2. 2. sponsors
    3. 3. AGENDA• What’s new in SharePoint 2013 workflow• Architecture• Workflow development with Visual Studio 2012• SharePoint Designer 2013 workflows• Demo: developing SharePoint Designer 2013 workflow
    4. 4. KEY INVESTMENT AREAS Apps and the Office and SharePoint Client Side Cloud App Model SharePoint Store Object Model SharePoint Server Workflow Access Side Object Model
    5. 5. WHAT’S NEW IN SHAREPOINT 2013WORKFLOWExpressive Connected UnboundedDo more withSharePoint Designerand declarativeworkflow
    6. 6. ARCHITECTURE Access SharePoint Control Events Content People Sharing 2010 WF SharePoint Designer OAuthVisual Studio _API (REST OM) Workflow Manager Workflow Services Manager Workflow Client Instances Interop Service Bus Deployment Messaging WF Service Application Proxy
    7. 7. APP HOSTING SharePoint Your Hosted Web Site SharePoint Azure Web Host web App Web (from WSP) Client side technologies and declarative workflows
    8. 8. WORKFLOW DEVELOPMENT WITH VS2012Workflow within Workflow Workflow object apps authoring model
    9. 9. WORKFLOWS WITHIN APPS Azure SharePoint SharePoint Web Web App App Your Web Web Hosted Site SharePoint Web Your Hosted App App Web Logic Lists and HTML / JS UI other data Workflow Other Resources e.g. CRM Lists and other data
    10. 10. WORKFLOW AUTHORING • Directly leverage Workflow Foundation 4.5 • Custom Activities
    11. 11. WORKFLOW OBJECT MODEL Workflow Services ManagerDeployment Instance Subscription Messaging Interop Service Service Service Service Service
    12. 12. SAMPLE CODEfunction initWorkflowDeploymentService () {function validateWorkflowDefinition() { _wds = _wsm.getWorkflowDeploymentService();function initWorkflowServiceManager() { _result = _wds.validateActivity(textArea.value); _hostCtx.load(_wds); _wsm = SP.WorkflowServices.WorkflowServiceManager.newObject(_hostCtx, _hostWeb); _hostCtx.executeQueryAsync( _hostCtx.executeQueryAsync( _hostCtx.load(_wsm); function () {}, validateWorkflowDefinition, _hostCtx.executeQueryAsync(initWorkflowDeploymentService); function (sender, arg) { handle(arg.get_message(), arg.get_stackTrace()); } function (sender, arg) { handle(arg.get_message(), arg.get_stackTrace()); }} ); );}}
    14. 14. BIG NEW FEATURES
    15. 15. BIG NEW FEATURES
    17. 17. WORKFLOW MANAGER INSTALLING AND PAIRINGAvailable via Web Platform Installer or Download CenterWorkflow Manager 1.0Workflow Manager Client 1.0Pairing PowerShell CommandFarm ScopedRequires Workflow Manager Client on SharePoint machineRegister-SPWorkflowService –SPSite “https://{rootUrl}”–WorkflowHostUri “https://{WfsvcVipDnName}:12290”  Note: OAuth requires SSL in production. Set Workflow Service Uri to DNS hostname of Virtual IP.
    18. 18. questions?http://www.SharedPointOfView.com // @IvanPopek