Code2care : TechZone Apps & Tutorials

Sharepoint : Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow.



Description


If you have a LARGE (even just few Approval processes) SharePoint Designer 2010 workflow, sometimes an error occurs stating that the workflow cannot be published.

Solution


If you have a LARGE (even just few Approval processes) SharePoint Designer 2010 workflow, sometimes an error occurs stating that the workflow cannot be published.

"Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow"

Wow !! "Unexpected Error" ... I bet this won�t provide any further details which are helpful for troubleshooting.

This error keeps popping whenever you try to publish the workflow.

REASON


This problem is caused by the large number of Types that are created during workflow compilation, for workflows with many local workflow variables. It is more common for workflows with multiple Approval Process actions, as each preconfigured Approval Process Action comes with a large set of local variables, for the different configurable property of the Approval Process.

Prior to the February 2011 CU, limits on the complexity of the workflow definition were enforced by the Microsoft .NET 3.0 workflow compiler. With the February 2011 CU, SharePoint uses the SPWebApplication UserDefinedWorkflowMaximumComplexity property to enforce a maximum number of Types in the workflow definition, and prevent compilation in these cases.

RESOLUTION


Make sure the February 2011 CU is installed - this will make available the UserDefinedWorkflowMaximumComplexity property.

By installing a CU that includes the server February 2011 CU, SharePoint administrators are now able to prevent compilation of workflows whose compilation would affect the performance of the farm. The default value of the property is 7000, but can be changed based on the needs and profile of the SharePoint farm.

The following PowerShell script can be used to adjust the value per SPWebApplication -

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$new_limit = XXXX (Set the limit here as a number);
$webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("http://WebAppURL")
$webapp.UserDefinedWorkflowMaximumComplexity = $new_limit
$webapp.Update()


Try publishing the workflow now, will get through ! - but takes some time due to heavy workflow (heavy for SPD)


Recommendation - For larger workflows, try to restructure to either have more reusable pieces, or be broken out into smaller individual small workflows.

Top


Posts related to sharepoint.


1. SharePoint does not allow uploading flash files

2. SharePoint List Attachments missing from customized Display Form (DispForm.aspx)

3. Setup synonyms or alias or thesaurus in SharePoint

4. How to exclude results from SharePoint Search

5. Sign in as different user missing in SharePoint 2013

6. Recover SharePoint if the SQL Server IP changes

7. How to Configure PDF iFilter For SharePoint

8. SharePoint Multiline Textbox Line-Break issue with customized XSLT Display form (DispForm.aspx)

9. Create Performance Point Dashboard in SharePoint

10. How to get SharePoint List Item URL using PowerShell

11. How to hide quick launch in SharePoint

12. SharePoint Text Site Column appended comments missing on customized Display Form (DispForm.aspx)

13. Sharepoint Errors Were Found When Compiling The Workflow. The Workflow Files Were Saved But Cannot Be Run

14. Bypass domain name for IIS site

    more...
Code2care : Lines of Code for Change
Code2care is an initiative to publish and share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities.





Android app on Google Play    








Popular tags
android
x 175
eclipse
x 29
notepadplusplus
x 20
macosx
x 14
sharepoint
x 14
html
x 14
mac
x 13
androidstudio
x 11




1000+ C Programs     PHP Tutorial     JSON Tutorial     Swift Tutorial     India Pinocdes     About Us     Privacy Policy


Code2care © 2012-15