Set workflow for project templates using PowerShell



Sitecore PowerShell is very powerful tool that helps in many kinds of tasks especially the repetitive tasks, in this blog I am sharing with you a small script that helps to add workflow to all Project templates







      
$allItems = Get-ChildItem -path "/sitecore/templates/Project/{Your Project}" -Recurse 
foreach($item in $allItems){
    if($null -ne $item["__Default workflow"] -and $item.Name -eq "__Standard Values"){
            Write-Host $item.Paths.FullPath
            $item.Editing.BeginEdit()
            $item["__Workflow"]=""
            $item["__Default workflow"]="{Your Workflow ID}"
            $item.Editing.EndEdit()
    }
}

Comments

Popular posts from this blog

Sitecore Multi list Code Data Source

Organize media files using Sitecore PowerShell

C# Numeric types Overflow