1

I have a list on which there are 2 workflows. Both workflows are created in SharePoint Designer 2010. Workflow "A" have the following triggers 'Start workflow automatically when an item is Created' and 'Start workflow automatically when an item is Changed'.

Workflow "B" has the following trigger 'Start workflow automatically when an item is Created'

Both workflows is set to run when an item is added to the list.

What is the execution order of the workflows ? how can I set it ?

1 Answer 1

2

Heine,

for that scenario you can't set up the execution order for workflows.

How it works

Below is description what happens behind the scene when workflow is being published in SPD.

While publishing workflow, for example using SPD, the new entry is added to the table Workflow Association that is used for storing information about associated workflows.

Below for the illustration purposes is shown the scheme for the table enter image description here

To organize the execution order of workflows, potentially only two columns can be used:

Created

Modified

ID that has Uniqueidentifier data type cannot be used for sorting.

Further, when workflow is configured with Auto Start parameter enabled, SharePoint add the SPWorkflowAutostartEventReceiver receiver. This receiver is responsible for retrieving and starting workflows when list item is created and(or) changed.

On DB level for retrieving list of workflow associations stored procedure (SP) proc_GetWorkflowAssociations is executed. But SQL select query for SP has no sort specified.

Conclusion

As a result, we can not rely on publication date. The order of execution is not dependent on publication date, because of:

  • no sorting is used internally when list of workflows for execution are retrieved
  • there is no possibility to specify sorting for SPWorkflowAutostartEventReceiver receiver

I recommend to consider a different approach here.

If you have a several workflows that starts automatically and have to be executed in ordered way, it possible to create the chain of workflows in such a way that next workflow starts after previous one completes. For details please see activity Start Another Worflow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.