SPD2013 Workflow - Activity 'DynamicActivity' has 51 arguments
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:
- Reuse some variables to reduce the number of variables (No changes to the servers required)
- Increase the permitted amount of variables in the database (Not recommended.. Seriously. Don’t do that)
- 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
$wfProxy = Get-SPWorkflowServiceApplicationProxy $wfProxy.GetWorkflowServiceAddress((Get-SPSite -Limit 1 -WarningAction SilentlyContinue))
Get the current Configuration
Get-WFServiceConfiguration -ServiceUri http://workflow.contoso.com:12291 -Name WorkflowServiceMaxArgumentsPerActivity
Set the Configuration
Set-WFServiceConfiguration -ServiceUri http://workflow.contoso.com:12291 -Name WorkflowServiceMaxArgumentsPerActivity -Value 100
See more configuration options.