locked
CRM 2011 Online - Plugin Workflow running order RRS feed

  • Question

  • I have an entity with a Plugin and a Workflow.

    I get an intermittent error in the plugin: "A record required by this process could not be found".

    It very much looks like the line that causes the issue is one where the workflow is updating the entity which triggered it.

    I suspect that (and correct me if I am wrong), because the Plugin and Workflow are both Async, that they both run at the same time so sometimes the Plugin has not finished before the Workflow begins, therefore the entity record is not viewed as created or maybe it is locked.

    I could add a wait statement in the plugin or maybe I could add a flag to the entity and wait for that to be set.  However I feel there must be a better way to ensure that the workflow waits until the Plugin is complete.  I would have expected this to be the default behaviour anyway!!

    Tuesday, October 30, 2012 9:42 AM

Answers

  • Hi,

    UPDATE: check this article.

    "In addition, the dependency token cannot be used to order execution of asynchronous registered plug-ins because the asynchronous operation that executes plug-ins is created by the Queue Manager"

    So, I guess there is no way to set the order. It is handled by the queue manager. I would go with the flag and the wait condition option to ensure dependency of your plugin and your workflow.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.



    Tuesday, October 30, 2012 9:47 AM
  • Hi Gordon,

    why don't you register plugin in synchronous mode........???

    or 

    Set a flag value in plugin and use Wait condition in workflow with that flag.

    SASANK K

    Tuesday, October 30, 2012 9:55 AM

All replies

  • Hi,

    UPDATE: check this article.

    "In addition, the dependency token cannot be used to order execution of asynchronous registered plug-ins because the asynchronous operation that executes plug-ins is created by the Queue Manager"

    So, I guess there is no way to set the order. It is handled by the queue manager. I would go with the flag and the wait condition option to ensure dependency of your plugin and your workflow.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.



    Tuesday, October 30, 2012 9:47 AM
  • Hi Gordon,

    why don't you register plugin in synchronous mode........???

    or 

    Set a flag value in plugin and use Wait condition in workflow with that flag.

    SASANK K

    Tuesday, October 30, 2012 9:55 AM
  • Thanks, this looks like what I want.

    It doesn't say how to set the AsyncOperation.DependencyToken in the workflow though but I'll have a look into it.

    G

    Tuesday, October 30, 2012 10:03 AM
  • I'll have to go with the flag option.  The plugin takes just a little too long to run Synchronous.

    The Workflow seems to be missing any form of Dependency field which is a shame as it would be more elegant to set it up that way.

    Thanks for your help.

    Tuesday, October 30, 2012 10:31 AM