This post has been republished via RSS; it originally appeared at: SharePoint Support Blog articles.
- You would have come across scenarios, where you create a SharePoint 2010 workflow from designer and publish it. But once you log in to the site and the list or libraries, the workflows are not shown.
You attempt to start the workflows from powershell or using an Auto Start, no response and no errors in ULS
Cause : The issue occurs, because the workflow's .xoml, .xoml.wfconfig.xml , .xsn files in the "Workflows" library are all checked out to the user who last Published the workflow.
By default, the workflows library, should have only the FileLeafRef (Name) as required true, and if there are any other fields apart from this with required set to true, then the files are forced to be checked out to the user who last published it
$web = Get-SPWeb http://sp/
$wflist = $web.Lists["workflows"]
$wflist.Fields | where {$_.required -eq "True"} | select Internalname,ID, Required, title
Expected :
InternalName Id Required Title
------------ -- -------- -----
FileLeafRef 8553196d-ec8d-4564-9861-3dbe931050c8 True Name
- If there are any fields marked as required true, apart from the above, then you need to either remove it or mark is as required = false
From Designer , If you log in to the site and navigate to All Files > Workflows > Name of the workflow you created (test WF is the one I used)
You would see the files checked out like above
Solution :
1. You should first make the field as required= $false
$field = $wflist.Fields.GetFieldByInternalName('NewFIeld')
$field.Required = $false
$field.Update()
2. You need to then manually check in those files from SharePoint Designer or powershell
3. Republish the affected workflows
Note : By default, we shouldn't be making any changes to the Workflows Library or "user workflow document" , by adding or removing any fields which would tamper the behaviour.
PS Script to find the workflows library, if fields are added
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$webapps=Get-SPWebApplication
foreach ( $webapp in $webapps )
{
$sites = $webapp.Sites
foreach ( $site in $sites )
{
$webs=$site.AllWebs
foreach ( $w in $webs)
{
foreach( $list in $w.lists )
{
if($list.Title -eq 'Workflows')
{
foreach($f in $list.Fields)
{
if($f.required -eq $true)
{
Write-Host $f.Title 'is required in' $w.Url
}
}
}
}
}
}
}
$site.Dispose()