2

We are currently working on the Upgrade Project from version 9.0.2 to 10.3. During our work on personalization rules, we encountered an issue. Some items' IDs are missing on components where the personalization rules are applied. Upon comparing the latest content tree structure with the previous one, we discovered that the items exist with the same name but have different IDs.

I would like to inquire if this behavior is expected during the upgrade process. Additionally, could you please provide guidance on a feasible solution to address this issue?

Item in 9.0.2 Version

enter image description here

Item in 10.3 Version enter image description here

1 Answer 1

1

Unfortunately it is expected, as a few conditions were removed and replaced by the items with new IDs between Sitecore versions 9.0.2 and 9.2.0. This knowledge base article lists some of the conditions but it is not the full list because there were a few more that had changed prior to 9.1.0.

However, the solution explained in the article is still applicable - you should replace IDs of the old conditions on pages where they are used. If you do not have too many pages with this issue (let's say up to 10 or 20 pages), then the easiest option is to edit personalisation rules manually and re-configure them using the new condition items.

If you have too many pages to go through them manually, you can try to do this programmatically using a temporary .aspx page or Sitecore PowerShell script. Here is an example of PowerShell script for replacing old IDs with new ones:

$oldID = "{331C6356-630C-4F5B-Af4B-7B21DBDAA3D7}"
$newID = "{52E42C59-7210-43E5-94A6-3EA6B98835B8}"
$items = Get-ChildItem -path "master:/sitecore/content/Home" #implement your own logic of retrieving the necessary items

$items | ForEach-Object { 
   $item = $_;
   Write-Host $item.Paths.FullPath
   
   #updating shared layout renderings
   $sharedLayout = $item.Fields["__Renderings"]
   if($sharedLayout -ne $null -and $sharedLayout.Value.Contains($oldID)){
        $item.Editing.BeginEdit()
        $item.Fields["__Renderings"].Value = $sharedLayout.Value.Replace($oldID, $newID); 
        $item.Editing.EndEdit()
        Write-Host "Updated shared layout for the item " $item.Paths.FullPath
    }
    
    #updating final layout renderings
    $finalLayout = $item.Fields["__Final Renderings"]
    if($finalLayout -ne $null -and $finalLayout.Value.Contains($oldID)){
        $item.Editing.BeginEdit()
        $item.Fields["__Final Renderings"].Value = $finalLayout.Value.Replace($oldID, $newID); 
        $item.Editing.EndEdit()
        Write-Host "Updated final layout for the item " $item.Paths.FullPath
    }
}
1
  • 1
    Thanks Anna. Let me check it. Commented Oct 10, 2023 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.