locked
Which one execute first, Plugins and Workflows? RRS feed

  • Question

  • Hello,

    I know we can define the execution order for plugins. Also, I know we can define execution order for Workflows too.

    The question is, which of Workflows or Plugin will execute first? Can that be defined?

    Thank you,

    Wednesday, June 3, 2015 4:43 PM

All replies

  • Someone else can expand a bit more on this, but the answer is...it depends.

    Prior to CRM 2013, Synchronous Plugins would almost always run before Workflows, because there was no Synchronous/Real-time Workflow.  And there is such a thing as an Asynchronous Plugin, so that complicated matters.

    Starting with CRM 2013, Microsoft introduced real-time workflows, which are essentially like synchronous plugins but more point-and-click to maintain them.

    In addition, when you register a Plugin step, you can define the execution order, and there are tools to allow you to edit the execution order.

    https://community.dynamics.com/crm/b/crmbusiness/archive/2014/04/24/crm-2013-tool-plugin-and-workflow-synchronous-events-execution-order-editor


    Wednesday, June 3, 2015 5:50 PM
  • Hi Chris,

    The plugin execution order is very well known.

    The laser focus of my question is the order of Workflow and Plugin execution.

    Thank you

    Wednesday, June 3, 2015 6:10 PM
  • I don't think you can specify the order, so you would have to architect your plugins and workflows to be aware of each other somehow. Synchronous will always execute before Asynchronous.  From what I can tell, in either Sync or Async, you can set execution order on plugins, but not workflows.   They can easily step on each other, so you have to be very careful how you use one or the other.
    Wednesday, June 3, 2015 8:20 PM
  • The scope of my question is synchronous workflows and synchronous plugin.

    The possible answer that I am looking for could be either of the following 4 items:

    a. synchronous workflows run before synchronous plugins

    b. synchronous plugins run before synchronous workflows

    c. this is not documented by Microsoft

    d. there is no guaranteed order

    Wednesday, June 3, 2015 9:02 PM
  • As per the POC done in the blog, (https://andz88.wordpress.com/2014/10/14/real-time-workflow-and-plugin-which-one-is-executed-first/)

    synchronous plugins run before real time workflows

    Monday, September 21, 2015 5:15 PM