i want to change the item template in all language version and retain the data. I have tried this :

$rootItem = Get-Item master:"/sitecore/content/home/"
$sourceTemplate = Get-Item "{E6787535-1C98-4C18-9D45-68DF4837BEF8}";
$targetTemplate = Get-Item "{CB1DACB2-0B85-4D92-9BC7-5EC0CF208E5F}";


Get-ChildItem $rootItem.FullPath -recurse | Where-Object { $_.TemplateName -eq $sourceTemplate.Name } | ForEach-Object {
    Set-ItemTemplate -Item $_ -TemplateItem $targetTemplate `
        -FieldsToCopy @{'Module ID'="AccordionModuleId" ;'Module Category' = "AccordionModuleCategory"; 'Module Title' = "AccordionModuleTitle"; 'Items' = "AccordionModuleLinks" }

But it works fine only for en language and for rest of the languages it is having empty field values. Any way of achieving this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.