Powershell | Sitecore | Update another field value from previous field value

$rootItem = Get-Item master:/content/Item1;  // Any item starting path

$ImagesourceTemplate = Get-Item "/sitecore/templates/Project/Presentation Templates/Article with Image"; // Template path


Get-ChildItem $rootItem.FullPath -Recurse | Where-Object { $_.TemplateName -eq $ImagesourceTemplate.Name } | ForEach-Object { 

        $_.Editing.BeginEdit()
        $titlefieldValue = $_.Fields["Title"].Value
        $_.Fields["ShortHeadline"].Value = $titlefieldValue;
        $_.Editing.EndEdit()

}

// This script will be updating all child items short headline field value from Title field value.

Comments

Popular posts from this blog

Sitecore 10 Installation on Docker

#Powershell script | items created/updated by user in sitecore last n number of days

String function i.e. Search, Equal ,Smaller, Greater,Getsub,LeftSub,Rightsub , Upper, Lower ,Reverse,Replace