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?

  • 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. – April Drake Sep 11 '13 at 23:27
  • Are you using custom outcome field? – Anuja Sep 12 '13 at 6:04
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()
}
}  
}
  • 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 :) – April Drake Sep 14 '13 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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