3

I have a problem (see Workflows do not continue after user completes a task nor do they update task outcome and percentage) that I can't get around. I thought about running a powershell script every night to work around it.

It would look for all workflows in a site collection and if their Task Status is = "Completed" it will update the Outcome and also % Complete fields.

I'm hoping that 'unsticks' my workflows.

Can someone point me to a PowerShell script that would do this?

2
  • As an aside, I cannot see the "Outcome" field in the Task lists' Column settings. I cannot use SPD to create a workaround script - one that would run on the Task list and if the Task Status = Completed to set Outcome = Completed. It doesn't "show" Outcome when I select the "Set Field" Action. Commented Sep 11, 2013 at 23:27
  • Are you using custom outcome field?
    – Anuja
    Commented Sep 12, 2013 at 6:04

1 Answer 1

1

you can try with following script,

 $list=$spweb.Lists["workflow list name"]
Foreach ($item in $list.Items) 
{
   $workflows = $item.workflows
   Foreach ($workflow in $workflows)
  {
    $tasks = $workflow.Tasks
    Foreach ($task in $tasks)
   {

    //Add your logic to update task property

    $task.Systemupdate()
}
}  
}
1
  • and...what would the logic BE to update the Outcome field? i'm not proficient in PowerShell and not a developer...I can run scripts if someone else writes them :) Commented Sep 14, 2013 at 1:06

Your Answer

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

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