Have you ever tried to publish a SPD2013 Workflow, only to be met with the error:

Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors: Activity 'DynamicActivity' has 51 arguments, which exceeds the maximum number of arguments per activity (50).

This means that you use more than 50 Variables in your Workflow. To fix that you have a few choices:

  1. Reuse some variables to reduce the number of variables (No changes to the servers required)
  2. Increase the permitted amount of variables in the database (Not recommended.. Seriously. Don’t do that)
  3. Increase the permitted amount of variables by a simple PowerShell line (Recommended)
    a. This requires admin access to your SharePoint servers

Often, people tend to use more variables than needed in SPD Workflows. But not always. If you are unable to reduce your Workflow to use any less variables than you already use, you only have Option 3 available to implement.

First up, you need the Workflow Service URI. That will most likely give you something like “http://workflow.contoso.com:12291/SharePoint/”. Delete the “/SharePoint/” part of that result and you have your ServiceUri. Copy that into a Notepad for later.

Next up, you need the -Name. This refers to the parameter in the configuration that you need information on. You need the value “WorkflowServiceMaxArgumentsPerActivity”.

Start by getting your current configuration, just to make sure that everything is as expected. If you get a score of 50, then you are set for the default config.

Get the ServiceURI

<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: plain; title: ; notranslate" title="">$wfProxy = Get-SPWorkflowServiceApplicationProxy            $wfProxy.GetWorkflowServiceAddress((Get-SPSite -Limit 1 -WarningAction SilentlyContinue))</pre>
</div>

Get the current Configuration

<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: plain; title: ; notranslate" title="">Get-WFServiceConfiguration -ServiceUri http://workflow.contoso.com:12291 -Name WorkflowServiceMaxArgumentsPerActivity</pre>
</div>

Set the Configuration

<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: plain; title: ; notranslate" title="">Set-WFServiceConfiguration -ServiceUri http://workflow.contoso.com:12291 -Name WorkflowServiceMaxArgumentsPerActivity -Value 100</pre>
</div>

See more configuration options.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.