Monday, March 21, 2016

A .NET Framework error occurred during the execution of user-defined routine or aggregate "GetAssignedUsers"

So, I found myself helping a client to troubleshoot a workflow issue. After configuring workflow a few weeks aback and running a few tests without any issues, we applied Microsoft Dynamics GP 2015 R2 January 2016 Hotfix.

Now, when the client went to execute the workflow, he received the corresponding email indicating there was a purchase order to approve. He then proceeded to click the Approve hyperlink and the process continued as expected.

After clicking the Approve button, the client receive the following error message:

The server encountered an error processing the request. See server logs for more details

The following shows the error as displayed on the client's screen.

At this point, it is worth stating that the workflow ran to completion and the PO appeared completely approved and fine in Dynamics GP, so whatever was causing this error did not seem to interrupt the approval flow.

As good troubleshooters, we went to the Event Viewer to check for additional information as suggested by the Request Error window, and came across the following error message in the log:

A .NET Framework error occurred during the execution of user-defined routine or aggregate "GetAssignedUsers

The complete error is displayed below:

As suggested by many solutions Dynamics GP forum solutions, we executed the following T-SQL statement against the system database:

EXEC wfDeployClrAssemblies;

Fellow MVP Mohammad R. Daoud explains in great detail what this stored procedure does and the CLR assemblies dependency, through an upgrade error he experienced here.

However, redeploying Workflow CLR assemblies did not solve our problem, even after restarting Microsoft Dynamics GP. 

In reviewing the workflow setup under the Workflow Maintenance window in Microsoft Dynamics GP we realized that the workflow had no managers assigned to it:

The client clearly remembers setting up managers before we applied the January 2016 Hotfix to their system -- at this point, we have reasons to believe this is a bug in the Hotfix update. After adding a few managers to the list, the client retried the workflow and all was good, without no errors.

In summary, if you run into this error, check to see if you have managers in the list. If you don't add them. If you do, then run the wfDeployClrAssemblies stored proc against the system database. These steps should solve most of the problems related to this issue.

Until next post!

Mariano Gomez, MVP


Matt said...

Excellent! Thanks for the tip, ran into this same issue and executing the stored procedure fixed it.

Steve Simon said...

Very grateful for this post, Mariano. Again you saved my bacon with GP.

Steve Simon
PDG Consultants