1

I am trying to clean up a workflow prior to removing it from my site collection.

  • The workflow was written by a user who didn't use good practices on Stages, so the "workflow status" column just displays "Running" as the hyperlink to the status page, regardless of whether the workflow is completed or not.
  • According to the Workflow Status page, I have 3 instances of the workflow still running The workflow writes a piece of important information to it's status history log, but is not set to write those same lines to the history list.
  • I need to record that information before terminating the workflows and pulling it from the site.

so here's my question: Is there a way to find the instance IDs for those running workflows? Is there some way to do it besides clicking the workflow status link on every single item in the library, and checking all of the status pages to find the 3 I care about? Is there some way to display the "Internal Status" workflow field as a metadata column?

Thanks!

1

There was a very similar article written here that you can get this information using PowerShell.
How to get running workflow instances on listitems in powershell?

# Main
###########################
cls
$spSite = Get-SPSite  "https://portal.myCompany.net/teams/siterequests/" # SiteCollection
$spWeb = $spSite.OpenWeb()    
for($i = 0; $i -le $spWeb.Lists.Count;$i++)
{
    foreach ($item in $spWeb.Lists[$i].Items)
    {
        $runningWorkflows = $item.Workflows | Where-Object {($_.InternalState -eq "Running")}
        foreach ($workflow in $runningWorkflows)
        {
            ###Do Stuff###
        }
    }
}
  • That'll work, diving into PowerShell now... Thanks much! – parkanian Jan 10 '18 at 19:26

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.