Last active
December 14, 2020 16:34
-
-
Save Madhu-Anbalagan/67b5988fcd758e5487a009f02aeca7e1 to your computer and use it in GitHub Desktop.
Bulk Update Field Values Using Sitecore Powershell Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path = "master:/sitecore/content/external_forms" | |
$templateName = "EmailTemplate" | |
$emailAddresses = "test@test.com" | |
$fieldName = "ToEmail" | |
$items = Get-ChildItem -Path $path -Recurse | Where-Object { $_.TemplateName -eq $templateName } | |
foreach($item in $items) { | |
if($item.Fields[$fieldName] -ne 'null'){ | |
$item.Editing.BeginEdit() | |
$item.Fields[$fieldName].Value = $emailAddresses | |
$item.Editing.EndEdit() | |
Write-Host ($item.Name + ": " + $item.Fields[$fieldName].Value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment