Sitecore Powershell for Bulk update General Link "External" field
We have a general link field which pointing to different site url , but the domain name of that site changes due to some reason, so it makes us to update our general link field url, we have references in lot of place , so i tried to use the below scripts to update the domain name
$allItems = Get-ChildItem -Path 'master://sitecore/content/ Tenant/Corporate/Global' -Recurse
$allItems | ForEach-Object {
[Sitecore.Data.Fields.LinkField]$field = $_.Fields["Navigation Link"]
if($field.LinkType -eq "external")
{
$Url = $field.Url
$_.Editing.BeginEdit()
$field.LinkType = "external"
$field.Url = $Url.Replace('www.xxxx.com/news/','www.yyyyyy.com/news/')
$_.Editing.EndEdit() | Out-Null
Write-Host $_.FullPath
Write-Host $Url.Replace('www.dpworld.com/news/','www.dpworld.com/news/releases/')
}
}
Comments
Post a Comment