2014-12-11

Maximum Number of Variables per Activity

This issue has been raised on SharePoint StackExchange.

I am currently developing a Workflow 2013 in VS 2012 as a part of Full trust solution. I added a variable to the workflow and tried to deploy my solution but VS threw an error:
Error occurred in deployment step 'Activate Features': Microsoft.Workflow.Client.ActivityNotFoundException: The activity named 'WorkflowXaml_ed00d3bd_4796_41ba_b288_35ce2226f89a' from scope '/SharePoint/default/248fadea-e82b-4d15-bf03-d00b7947ca36/a6b8142a-8120-4823-a855-f400460ec143' was not found. HTTP headers received from the server - ActivityId: 56a026d5-261b-443e-bada-30ceb3417263. NodeId: ZG-SP2013-02. Scope: /SharePoint/default/248fadea-e82b-4d15-bf03-d00b7947ca36/a6b8142a-8120-4823-a855-f400460ec143. Client ActivityId : f86d411a-425b-42ab-8
After fiddling around with this issue for a few hours, I was able to locate more detailed exception message in ULS. ULS records have to have filter Level=Exception:
Workflow XAML failed validation due to the following errors:
Activity 'Sequence' has 51 variables, which exceeds the maximum number of variables per activity (50).
 HTTP headers received from the server - ActivityId: 2bb3ba9e-28d3-4820-91a7-f03ebdb98fdf. NodeId: ZG-SP2013-02. Scope: /SharePoint/default/248fadea-e82b-4d15-bf03-d00b7947ca36/a6b8142a-8120-4823-a855-f400460ec143. Client ActivityId : e87640d8-8819-4981-bbdb-c46c02eb6d6f.
I counted variables in my workflow and indeed there are 51 variable defined in the workflow. All of the variables are defined in root Sequence. Unfortunately, this is not documented in Workflow limitations web page on MSDN.

Solution:
Reorganize variables in multiple Sequences and reuse existing variables where possible.

No comments:

Post a Comment