Does anyone know how to Update droptree
field values through Powershell?
We have the bulk of items, which one of the field values as __Workflow state
under workflow section[while we can see enable standard template].
we need to update as a state(__Workflow state
) as empty for all the items. could you please suggest how we can write a query in Powershell.
$sourcepath="master:/sitecore/content/TestFolder";
$items= Get-ChildItem -path $sourcepath -Recurse
function Update-Item{
foreach($item in $items)
{
if($item.TemplateId -eq "{292FD0AD-CE76-4867-B43B-A58FC8F36530}")
{
Write-host "Updating Item Name and AGE:" $item.ID "";
$rawIds = [Sitecore.Data.Fields.ReferenceField]$item.Fields["__Workflow state"]
$item.Editing.BeginEdit()
$item.Editing.EndEdit()
}
}
$items = Update-Item
Close-Window