Pergunta

I've come across an interesting scenario with parallel tasks and workflow variables.

My versions are:

Sharepoint Online 2016
Sharepoint Designer 2013
Sharepoint 2010 Workflow Platform

I am developing a custom approval workflow that could have one or many approvers. The tasks are in parallel.

In the individual task behaviours, "Before a Task is Assigned", I am calculating a variable - per user - and then setting a field on the task. The issue is that every task is receiving the same value from the variable, when in fact the lookups are different and proven to be different when testing this individually.

Example:

Before a Task is Assigned
- Log "a" to the workflow history list.
- Look up a list and get a unique value for this user. Log the user name and variable result to the workflow history list.
- Log "b" to the workflow history list.

Assume the unique lookup values for Alex, Bob and Carol are 1, 2, and 3 respectively.

I would expect to see the following in the workflow history:

Workflow started
a
Alex: 1
b
a
Bob: 2
b
a
Carol: 3
b
End

However I am seeing the following every time:

Workflow started
a
a
a
Alex: 1
Bob: 1
Carol: 1
b
b
b
End

So it looks like the workflow is executing the actions line by line in parallel across tasks, and when it gets to the execution line involving the variable, the value is the same for each task/user.

However I need the workflow to execute each task's behaviours in serial before moving on to the next task's behaviours. I have tried grouping together the sections in Steps, Parallel Blocks, etc. in different combinations but the result is always the same. I also tried adding a Pause in the middle of the code but it pauses the entire workflow, and adding a Pause at the end of the "Before a Task is Assigned" step does not help because it pauses only after the "three b's in a row" scenario shown above.

Is there any way I can force actions within a task to execute in serial, preserving or somehow dedicating the variable per task, and then moving on to the next task? Parallel tasks but processed by the workflow engine independently?

Thanks in advance...

Alex

Foi útil?

Solução

I found a solution to my problem after taking a break from it.

Instead of using variables I just did the lookup directly in the "if" statement.

For example, I was doing 3 lookups and putting the results in variables, then doing an "if" statement using the variables to determine the value for my column. Now I just do the lookups directly in the "if" statement, and sure enough, the results are unique for each task/user.

Guess this site isn't as active as I thought or no one had any interest/expertise in this topic. Thanks anyway ...?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top