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 wont 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 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.
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.
- SharePoint An unexpected error has occurred - Correlation ID and Merge-SPlogfile
- SharePoint list excel import error - Title is a required filed and can't be empty
- Send Email with attachment using SharePoint PowerShell, SMTP server
- Sharepoint errors were found when compiling the workflow
- How to update SharePoint List Item programmatically
- Merge-SPlogfile PowerShell - SharePoint Correlation ID error
- Get-ADUser PowerShell - Get AD user details using email address
- Restore deleted Office 365 SharePoint group site
- [Solved] SharePoint Access Denied error editing Document Name
- How to migrate SharePoint Designer 2010 workflow to Power Automate FLOW (Microsoft Office 365)
- How to know if someone has read your WhatsApp message - WhatsApp
- Android Studio NoClassDefFoundError: java.awt.Toolkit - Android-Studio
- WhatsApp launches WhatsApp Web to Access Messages over web browser - WhatsApp
- What is Android Toast.LENGTH_SHORT and Toast. LENGTH_LONG durations - Android
- Check Wifi Connection static Android Programming - Android
- Android Constant and Resource Type Mismatches Lint - Android
- How to Word wrap eclipse console logs width - Eclipse
- How to hide Navigation bar from Android Screen Activity - Android
- Share image and text Twitter using your Android Application Programatically - Twitter
- WhatsApp Web escanner - WhatsApp
- Programmatically check if Facebook is installed on Android device - Android
- Install Apache Tomcat ver 8 on Mac OS X Yosemite 10.10 - Mac-OS-X
- Disable Control Scroll Zoom-in and Zoom-out in Notepad++ - NotepadPlusPlus
- Can we move apps like WhatsApp, Facebook to external MicroSD card - WhatsApp
- Java: Check Internet connection on Android Device (Wifi or Mobile) - Android