If you have a LARGE (even with just a few Approval processes) SharePoint Designer 2010 workflow, you may come across an error stating that the workflow cannot be published with message "Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow.".
This error keeps popping whenever you try to publish the workflow.
This error is known with SharePoint 2010 workflows, but can occur for other SharePoint versions as well.
As a developer, "Unexpected Error" is of no use for troubleshooting with SharePoint. So how do we go about?
The 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 reconfigured 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.
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 (SharePoint Management Shell - Run as Administrator) 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 SharePoint 2010 Designer).
For large workflows, try to restructure and either have more reusable pieces, or break out into smaller individual small workflows.
Check if you have multiple versions of the same workflow and older items attached to it, remove older versions of the workflow if required after completing the in progress ones.
Have Questions? Post them here!
- Managed Metadata error - The data returned from the tagging UI was not formatted correctly
- How to generate client id and secret to register SharePoint App with OAuth
- Create SharePoint Site Collection with new Content database in existing web application
- Fix Error 2711 SQL RBS client - The installer has encountered an unexpected error. The specified Feature name ('Docs') not found in Feature table
- How to exclude results from SharePoint Search
- 'Edit Document' Requires a Windows Sharepoint Services-compatible application and Microsoft Internet Explorer 6.0 or higher
- [Solved] SharePoint Access Denied error editing Document Name
- Recommended size and resolution for SharePoint Online Site logo
- SharePoint Server 2016 IT Preview - new improved Features and Enhancements
- Restore deleted Office 365 SharePoint group site
- SharePoint An unexpected error has occurred - Correlation ID and PowerShell Merge-SPlogfile
- [Solved] SharePoint Search Internal server error exception
- SharePoint CAML query error - The XML source is not correct
- How to hide quick launch in SharePoint classic site
- Not receiving email notification alert in SharePoint Online workflow - Power Automate, FLOW
- Change SharePoint search results FullTextSqlQuery RowLimit 10000
- Fix Power BI error Access to the resource is forbidden when connecting SharePoint Online List as data source
- [Fix] Restricted View permission level missing in SharePoint Online site library
- How to upload file programmatically to SharePoint Document Library using Server Object Model C# .Net
- How to create classic site in SharePoint Online
- That did'nt work, Issue type User not in directory - SharePoint external access error
- Merge-SPlogfile PowerShell - SharePoint Correlation ID error
- Fix Power BI 404 not found error when connecting SharePoint Online List as Data Source
- SharePoint Server 2016 IT Preview Deprecated Removed features
- SharePoint error - An exception occurred when trying to issue security token: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms..
- reCAPTCHA Implementation Tutorial - CSS
- AADSTS90033: A transient error has occurred. Please try again. [Microsoft 365] - Microsoft
- Increase Android Emulator Timeout time - Android
- How to remove Floating Action Button Android Studio Blank Activity Template - Android-Studio
- Top 3 Awesome Text Editors developers prefer at workplace - Sublime