Views:

Dynamics 365 (8.2 +)

Unexpected exception from plug-in (Execute): CustomWorkflow: System.AggregateException: One or more errors occurred.  

Throwing an error in a Custom Workflow Extension
Dynamics 365 has introduced a bug that occurs when you attempt to throw an error message in a custom workflow extension. Instead of throwing the error as programmed, they are now throwing their errors as 

Unexpected exception from plug-in (Execute): CustomWorkflow: System.AggregateException: One or more errors occurred.

You can read about more about the bug at the below link - a support case has been opened with Microsoft and they heva confirmed that they will fix this bug.

https://community.dynamics.com/crm/f/117/t/222657

Workaround

If you are encountering this issue when using a North52 formula to throw an error back to your user, you can change the Process Genie to return a value back to the workflow and then use the out-of-the-box functionality in Dynamics 365 to display the error message. 

For example: the process genie might return true or false now, and a condition on the workflow would now check if the value is false then cancel the workflow with a message 'Your warning message here'. In a real-time workflow this message will be displayed back to the user.