Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
Please tag by feature or topic and not by version or product. This helps to attract more attention to your question and keep it relevant. See How do I use tags for general guidelines. –  Alex Angas Sep 12 '11 at 1:26
    
+1 for unique username :D –  Falak Mahmood Jan 31 '12 at 10:33
    
How about using an Approval Workflow Process? –  fr34kyn01535 Apr 13 '12 at 9:36
add comment

1 Answer 1

This feels like a race condition issue. Are you setting your counter to increase before assigning the task? If so, your workflow may be pausing, another instance runs, the counter is still 0, the first instance continues, sets the counter to 1, etc.

These issues can be tough to troubleshoot, as they're hard to repro - can you give us some more context on your workflow?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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