Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Cannot activate workflow in Dynamics GP

Cannot activate workflow in Dynamics GP

  • Comments 4

Patrick Roth - Click for blog homepageRecently one of the support engineers had a case they asked for my help on.

Dynamics Workflow was installed and a new PO Workflow was created and activated in Sharepoint. From the Sharepoint side, everything seemed to be working correctly.

In the Dynamics Workflow Setup window, after marking the checkbox to activate workflow for the company and hitting the OK button, Dynamics returns the error:

Unable to access workflow services.  Contact your system administrator.

Permissions on the Sharepoint server were checked as well as various install settings, and everything turned up correct.  But yet from the Dynamics side, Workflow couldn't be activated.

The Dynamics GP Workflow Setup window doesn't actually contact Sharepoint using the Dynamics Workflow Web Service methods directly.  Instead the Microsoft.Dynamics.GP.Workflow.Client.dll uses Visual Studio Tools to handle the calls  to the Workflow web service from the Microsoft.Dynamics.Workflow.Proxy.dll and then sets values on hidden fields that Dexterity reads.

Thinking perhaps the method call was failing and the exception silently swallowed, I wrote a small .NET winform to call the IsWorkflowEnabled method for each workflow type which would then enable the corresponding checkbox for each enabled workflow (that's a mouthful!).  The thought was that my application call would fail and we'd see the unhandled exception being thrown to give us a clue on the real issue.

The customer ran the application on their system for the company and it ran successfully without error.  It also successfully marked the PO Workflow as being enabled so we knew for sure that everything was running normally.

Interesting - calling the web service directly works correctly.  So what gives?

Sample C# code calling IsWorkflowEnabled for 2 workflow types

When the IsWorkflowEnabled method is called, Dynamics assumes the call will fail and marks a variable for the current call as "failed".  After the Microsoft.Dynamics.GP.Client.dll makes the web service call, if there is no exception the current call is marked as "successful" and the next workflow type is checked.  If an exception is thrown, Dynamics will then not make any more web service calls and the error message "Unable to access workflow services.  Contact your system administrator." is thrown.   

How can it be that Dynamics fails and my app runs OK?

Looking at the Dynamics GP source code, the only thing I could see is that there never was a web service call made.  To prove that for sure, the next step would have been to use a tool such as fiddler to capture the client outgoing http calls.  Or a script.log would also possibly show that the VSTools method was run which was calling the web service. 

But given that my application runs and the only way to fall into the "else" clause that gives the message above, the only thing that makes sense is that the web service call was never made.

How could that be?

To invoke the web service methods for workflow, Dynamics GP uses 'run script' on various fields on the 'Main Menu' form.  The Microsoft.Dynamics.GP.Client.dll has focus notifications on those fields and invokes the proper web service calls in response and sets the return data back into different window fields which the Dexterity then reads.

The only conclusion that I could come up with that fits is that the web service calls weren't being made by the client assembly.  And the only way that could happen is if the Microsoft.Dynamics.GP.Client.dll was disabled.  This could be done by not having the client assembly in your GP folder but then you get errors launching Dynamics and the customer didn't mention that they were getting errors.  The 2nd way is if in the Customization Status window (or from the Support Debugging Tool) the Customization Status for Microsoft Dynamics GP was set to "Disabled".

The suggestion was that the partner check to make sure that indeed the Customization Status for Microsoft Dynamics GP was set to "Enabled" and let us know the results.

Was that the issue?  Well unfortunately we don't know that for sure.  After repeated failed attempts to contact the partner to verify that this was the issue, the support engineer closed the case.  But I'm pretty sure that this was the issue as I can't see any other conclusion given the facts we saw.  One other note, the support engineer was familiar with the partner and their habits.  If the solution offered for an issue didn't solve it, the partner was quick to reply "Now what do we try?", but if the case was solved, the partner tended not to respond back.  Certainly not proof positive but sounds likely this was the resolution.

Regards,
Patrick

// Copyright © Microsoft Corporation.  All Rights Reserved.

// This code released under the terms of the

// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

  • Any update, we have the same problem here...

    thanks.

  • Horacio,

    No update.  As I noted in the article, after offering the possible reasons for this the customer never responded back.

    So the exact reason wasn't found.  

    But by using code as I have above on your system, you could check to see if the web service call works outside of GP.

    If that works, then you can check to make sure workflow is installed correctly.

    Then check to make sure that it seems to be running via a script.log.

    You could also install an app like Fiddler to see if it sees any web service calls happening when the GP client dll makes the call.  If you see that happening, then we know the calls are happening ok but just returning unexpected results.

    The whole thing is somewhat complex as you might imagine.  You would probably want to open a new support incident for workflow to help you resolve your issue.

    patrick

    dev support

  • Patrick,

    Interesting. now my issue is other way around. I have enable workflow in test and I am testing it in my test company and trying to disable it and it won't let me do that.

    The only reason I could think of is that I have few workflow still in process in and not yet completed.

  • You should be able to deactivate the workflow which should then move all documents to complete.  Once complete, it should then be able to be deleted.

Page 1 of 1 (4 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 5 and 6 and type the answer here:
  • Post