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

Merge Sort.

Selection sort.

Program on deque that implements a linked list.