Skip to main content

Posts

Showing posts from May, 2023

Featured post

XM Cloud content sync from prod to uat or UAT to prod step by step

When working with Sitecore, it’s common to need content synchronization across environments. Today, I’ll walk you through the steps to sync content from Production to UAT/TEST and vice versa. Steps to Follow 1. Set Up Your Workspace Create a folder on your computer where you will manage the script files and exported data. Open the folder path in PowerShell to begin scripting. We need to run some scripts in PowerShell to update the folder with the basic requirements for syncing content. PS C:\Soft\ContentSync> dotnet new tool-manifest PS C:\Soft\ContentSync> dotnet nuget add source -n Sitecore https://nuget.sitecore.com/resources/v3/index.json PS C:\Soft\ContentSync> dotnet tool install Sitecore.CLI PS C:\Soft\ContentSync> dotnet sitecore cloud login If the above error occurs, you will need to run a different command to resolve the issue. PS C:\Soft\ContentSync> dotnet sitecore init now, Again run above command to open and authenticate with XM Cloud. It will be there a...

PowerShell script to migrate content in Sitecore while taking specific item from CSV File

It's easy to read CSV file and migrate list of item which is specified in csv file. Upload CSV file at media item location . You can see below url which have mentioned. $url = "https://tst-cdn.domain.net/-/media/domain/temp/ItemName.ashx?x=1" $data = Invoke-WebRequest -uri $url  -UseBasicParsing | Select-Object -Expand Content $TargetLangs = @("zh-cn","zh-hk","fr","de","it-it","es-es","th-th") $csv = ConvertFrom-Csv $data $sourceItemPath = "master:\sitecore\content\SLA\corporate\" $destinationItemPath = "master:\sitecore\content\Shared Pages\Shared Press Releases\Corporate\" $templateId = "{7B0B5195-5462-444E-8D5A-40941F2EC9B5}" Write-Host "Get the source items and their fields" ForEach ($csvItem in $csv)  {     $increment=$increment+1     $csvItemName = $csvItem.URL.Replace("-"," ")     if($csvItemName)     {          $sourceItem = Get-ChildIt...

Sitecore computed field implementation and uses

  In Sitecore, computed fields can be implemented using the ContentSearch API. Computed fields allow you to dynamically generate values for fields based on custom logic or calculations. Here's an overview of how computed fields can be implemented and their common uses in Sitecore: Implementation of Computed Fields in Sitecore: 1.     Define a computed field class: Create a class that inherits from the Sitecore.ContentSearch.ComputedFields.IComputedIndexField interface. This class will contain the logic to calculate the computed field value. 2.     Implement the ComputeFieldValue method: Override the ComputeFieldValue method from the IComputedIndexField interface in your computed field class. This method receives an IIndexable object, which represents the item being indexed, and returns the computed field value. 3.     Implement the logic: Inside the ComputeFieldValue method, write the logic to calculate the computed field v...

sitecore item fr-be version failed to publish but able to publish en language in sitecore

 There could be a few reasons why the fr-be version of the Sitecore item failed to publish while the en version was successful: Check the publishing restrictions: It is possible that the fr-be version of the item has publishing restrictions applied to it, preventing it from being published. Check the item's workflow and security settings to see if there are any restrictions that may be preventing the item from being published. Check the publishing targets: It is also possible that the fr-be version of the item is not associated with the correct publishing target. Make sure that the fr-be version is associated with the appropriate target, and that the target is enabled and set up correctly. Check the language settings: Ensure that the fr-be language version is enabled in the Sitecore instance and that the language version is set up correctly. If the language version is not set up correctly, it may not be able to be published. Check the version history: It is possible that there may ...