0

I am having a SPD 2010 workflow created and deployed in my site collection and published globally as a reusable workflow. I have configured the workflow in my document library by associating it with my custom content types.

How will I ensure that the workflow has been triggered successfully using PowerShell?

I have 158 sub sites in my site collection and having 10 document libraries so I can not verify whether the workflow instance been triggered successfully or not in all the document libraries and all sub sites. So I have to write a PowerShell to get the column name of workflow instance.

How to get the workflow instance column name from the document library.

0

You can use below logic

$web = Get-SPWeb http://weburl
$list = $web.Lists["Document Library"]

//Get Workflow Association Name
foreach($association in $list.WorkflowAssociations)
{
    write-host $association.name

    //Find and init $associationName here
}

foreach ($field in $list.Fields)
{
    if($field.Type -eq [Microsoft.SharePoint.SPFieldType]::WorkflowStatus -and $field.Title -eq $associationName)
    {
        //$field is what you are looking for
    }
}

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.