SharePoint 2013: How To Increase Workflow Size Using PowerShell

Introduction

SharePoint 2013 comes with all new features and architectural changes from its previous version, SharePoint 2010. One of the biggest changes was Introduction to Workflow manager 1.0 as a new foundation for SharePoint workflow. The workflow execution engine now lives outside of SharePoint. Built on Windows Workflow Foundation 4, SharePoint workflows offer a new range of capabilities and enhancements.

SharePoint 2013 workflows are similar to previous versions of workflows except that they are powered by WF 4 and run in Microsoft Azure. They are also declarative-only (XAML) and designed to interact with the cloud and work with SharePoint add-ins. One of their primary benefits is that they enable you to remotely host and run workflows outside the SharePoint Server.

In this article I will focus on how we can update the Default setting/ configuration in workflow manager.

Scenario:

The Default Size of the SharePoint 2013 workflow is 5 MB which is quite enough until you are writing very complex or multi-level approval workflow.

designer
error

If your workflow size gets increased from 5 MB, at the time of publishing it you will see the following error message, Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:

The total size of the activity XAML including the referenced XAML is greater than the maximum allowed size of 51200 KB. HTTP headers received from the server - ActivityId: <guid>. NodeId: <ServerName>. Scope: /SharePoint/default/b1ab969e-9862-4628-bd9d-4727c78f0d7d/43a22c73-489e-4114-80f4-6a7453cc5a6f. Client ActivityId : <guid>

Solution:

As I say, everything is possible in SharePoint. You can fix the above issue by running few lines of PowerShell Command.

cmd

Note: You need to run this command where you have configured workflow manager.

Steps:

  1. Open the Start menu.

  2. In All Programs, go to Workflow Manager 1.0. Then click the Workflow PowerShell shortcut to RunAs administrator PowerShell console.

  3. First to get the current allowed size of workflow: type Get-WFServiceConfiguration and press enter. It will ask you to provide the workflow serviceURL. Enter it. Then in the name parameter, give the name of the configuration whose value you want to get. In this case it is WorkflowServiceMaxInstanceSizeKB.

    You will see the current value.

  4. To update this setting, type:

    Set-WFServiceConfiguration -ServiceUri <<workflo-service-url>> -Name “WorkflowServiceMaxInstanceSizeKB” -Value 6262880

    That’s it. Now you have successfully increased the default allowed workflow size. You can again verify it by running the Get-WFServiceConfiguration.

Summary:

In this article we explored how to increase the Size of SharePoint 2013 Designer Workflow using powershell. I will be writing another article on how to set up and configure workflow manager.

Reference:

Similarly you can set other configuration values See this article for more info on other configuration values.
 
Read more articles on SharePoint: