How does conditional start of a worklfow work in a technical view?

  • 2 September 2014
  • 6 replies
  • 1 view

Badge +5

We have a workflow, which starts when items are modified and one condition set to a field value. Problem is that the library has many content types and therefore many columns. Because of that the form when editing the properties needs above 10 seconds to close. When i remove the condition it kicks in 3 seconds! So my question is, how is the mechanism working. Is he looking at each field to actually find the field to compare to and then check the value? Or is he able to go directly to the field and compares the value which would mean that the problem is comparing the value and not finding the right field.


6 replies

Badge +17

Victor,

This is a more of a general sharepoint issue. When you place a condition such as this for a workflow, it does iterate through all columns until it finds the one that meets the criteria.  What the condition does is start a query on the list/library to find that field and does the field match.  So in theory, the more columns or content types you have, the longer it would take.

 

I would say relook at the reason for the condition and see if there was a different way to start that workflow such as adding a "Run-If" in the action steps of the workflow itself and have the workflow run on any change.

Userlevel 7
Badge +17

There are even more ways to specialize this kind of workflow, like create a reusable workflow and specify it to your custom content type so it runs for just that content type.

But I would recommend in this situation to just add a pause for 1 minute (which just waits for the next time the timer job runs) as the first action.

This will help the form to close quicker, and then the condition to run in a different process, not in the same process as the user on the form.

Badge +5

Hi Eric, thx for your answer, that was exactly what we did but it wasn't a nice solution because everytime the workflow starts and spams into history and therefore my question. Initially I wanted to know what is the difference between looking in a start condition at the value (then it runs slow) and looking in a "Run-If" Action at the value (then it runs quick). The answer for that is something with different event recievers which do the job i guess...

Badge +5

Hi Andrew, also thanks for your answer, we also tried the pause for 1 minute but that was't suitable for our case because as the timer job takes a while it takes up to 5 minutes until it goes on and that ment in our case that the document is too long in a state without the right permissions we needed for it.

So we wen't now with the "Run-If" solution although this starts many useless workflows.

Userlevel 7
Badge +17

Awesome, and thanks for providing the feedback of what works well in your case. It will be helpful for others.

With the Run-If built in, did you create multiple workflows, all with a run if to see which value changed? Is that what you mean? There are other ways around that if so.

Also, I remember having a commit pending changes as my first action of a workflow to do something similar. Are you able to see if that could help?

Badge +5

Hi Andrew,

it was just about one workflow which now starts always and stops immediately when the conditions in the first action doesn't meet the requirements. And yes I also tried it with the commit pending changes but that didn't work well. For that test the delay worked better.

Reply