Sunday, September 27, 2020

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.

No comments:

Post a Comment

Please Give Some Comment

Featured post

Sitecore 10 Installation on Docker