I have a custom process in a SharePoint 2010 workflow where I need to allow the first participant to be able to change the second participant in the participant list.
What I have tried is asking the 1st participant for the name of the second participant in the task form. I then use "Insert A Task Assigned to" in the "When A Task Completes" steps to add the second participants name.
This part works.
What doesn't work is the "Before A Task is Assigned" step. It seems references to the task are incorrect in this step for the second participant only, but correct for every other participant.
I have the following code in the "Before A Task is Assigned" step:
if Variable: counter equals 0
set task field show_field to yes
else
set task field show_field to no
log [Current Task:Id], [Current Task:show_field], [Variable: counter]
Counter is incremented for each participant (0 for 1st, 1 for 2nd, etc).
What the log shows:
1st participant: 0, true,0
2nd participant: ###, true,1 (where ### is the task ID of the 1st participants task)
3rd participant: 0, false, 2
The 2nd log should be 0,false,1. Sometimes the 2nd log message will show ###, false,1 but the task form still acts like show_field is set to true. Sometimes the 2nd participant will log correctly and the task form looks correct. The 3rd (and following) tasks all look correct. As far as I can tell, the 2nd log has "Current Task" actually set to the "previous task", so the logging is probably invalid.
What am I doing wrong?