Error publishing a SharePoint workflow into Workflow Manager: exceeds the maximum number of arguments

Symptom

You are trying to deploy into Workflow Manager a SharePoint Workflow 2013 from SharePoint designer, but you got the following error:

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

HTTP headers received from the server - ActivityId:76d43779-6288-4623-bbc9-df7b33b33e21. NodeId: FPCJUBSPWFE. Scope:/SharePoint/default/e16260b4-462f-4e35-bec5-50f2e6859014/2c817785-89e2-43a6-8bb4-f7f4141a4570.
Client ActivityId : 9528eb9c-8f1f-d0cc-36f7-38a6c53b7713”

Cause:

By default, the maximum number of Arguments that a workflow can receive in Workflow Manager is 50. However, you can modify it as required.

Resolution:

The only supported way to modify configuration parameters in Workflow Manager is by using WFM PowerShell cmdlets. For this specific case the cmdlet  to use is “Set-WFServiceConfiguration.”. Below all the steps required:

 a)    Change the value of “WorkflowServiceMaxArgumentsPerActivity” parameter by executing:

Set-WFServiceConfiguration -ServiceUri <Your WFM FQN URI> -Name WorkflowServiceMaxArgumentsPerActivity -Value <New Value>

b)     Confirm that the value was changed properly by executing: Get-WFServiceConfiguration -ServiceUri <Your WFM FQN URI> -name WorkflowServiceMaxArgumentsPerActivity

c)     Restart WFM services so that the change takes effect: Open a Workflow Manager Powershell command and execute "Stop-WFHost" and then "Start-WFHost" in every WFM server.

 

Hope it helps.