Posts

Switching Docker Desktop to Docker CLI in Easy Way

Hello everyone! In this blog, we'll explore an important aspect of Docker development with Sitecore. Most of us are familiar with using Docker Desktop for our development needs—it's user-friendly and offers a great interface for managing your Docker environment. However, the downside is that it's a licensed product. Let’s explore how Docker CLI can help us eliminate the licensing costs associated with Docker Desktop. We'll also look at how smoothly we can transition from using Docker Desktop to Docker CLI Step 1 : Uninstall Docker Desktop Step 2 : Install Docker Engine and CLI Uninstall Docker Desktop Make sure containers are stopped using following cmdlets: # Leave swarm mode (this will automatically stop and remove services and overlay networks) docker swarm leave --force # Stops all containers docker ps --quiet | ForEach-Object {docker stop $_} If you want to remove all containers, container images, networks, and volumes from your syste...

Automating Tag Update in Sitecore XM Cloud with PowerShell - A Use Case

Managing tags across different environments in a Sitecore setup can be a challenging task, especially when dealing with a large number of items and multiple folders. Automating the synchronization or updating of these tags can save time and reduce errors. In this blog post, we'll explore a practical use case of using Sitecore PowerShell Extensions (SPE) to automate the synchronization of tags between shared and global environments in a Sitecore instance Use Case Imagine you are managing a global website for a large corporation, such as ABC company. Your content is distributed across various regional sites, and each region uses a different set of tags stored in different folders.The respective page content are tagged with site specific tags. However, for consistency,The business ask you to ensure that tags from the shared environment should be used from now on. But there is catch while you make the changes. You need to make sure that all existing website content pages should be ta...

Power Of Sitecore Module In XM Cloud

Image
In this blog, we will explore how to automate the process of creating roles with appropriate permissions when working in a multilingual and multisite environment. As soon as we think about automation, PowerShell scripts are often the first tool that comes to mind. And you’re absolutely right—we will be using PowerShell scripts, but with a twist. We'll leverage Sitecore Modules to approach this differently, integrating the module into the scaffolding definition. This way, whenever a new site is created in XM Cloud, roles and permissions will be automatically set up. So let's quickly start. Before we move forward, I recommend reading my previous two blogs on role creation and assigning proper permissions, which are explained through a specific use case. We'll be using the same use case for our purposes here. Roles Creation Assign Permission We will divide the blog into 2 section. Creating the Scripts Creating the Module Creating the Scripts in Script Library We ...

PowerShell Script For Creating Roles and Permission Part 2

Hello everyone, this is continuation of blog where we have seen how to create appropriate roles to manage content authoring more effectively. You can refer the part 1 of blog here Now our focus will be on assigning the permissions to the roles which was created on previous blog. Let's see the script that is required to update the permission. $siteLanguages = @("en-IN") $siteName = "IN" $siteType = "External" $Organization = "ABC" $region = "Asia" $rolePrefix = "$Organization $siteType $siteName" $siteAccessRole = "$rolePrefix Access" $siteAdminRole = "$rolePrefix Site Admin" $contentAdminRole = "$rolePrefix Content Admin" $contentContributorRole = "$rolePrefix Content Contributor" $contentPublisherRole = "$rolePrefix Content Publisher" $contentPreviewerRole = "$rolePrefix Content Previewer" #Content $regionPath = "/sitecore/content/$Organization...

Common Errors and Limitation in XM Cloud Development

Image
Hello everyone, In this blog, I will try to list down all the posssible error or limitation that is encountered during development in XM Cloud. This blog will be continous blogpost which will be updated over the period of time. This blog will be divided based on two sections. 1. Errors and 2.Limitation Section 1: Errors : Many errors are question asked to Sitecore and they have replied back with answers. 1. Access to fetch at 'https://edge-platform.sitecorecloud.io/v1/forms/data/4b24e4eae68d49cf8eb1692452625d2e-use' from origin '****.vercel.app' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.Understand this error Solution: 1. Added Vercel.json using below code for cors headers": [ { "source": "/(.*)", "headers": [ { "key": "Access-Control-Allow-Origin", "value": ...

PowerShell Script For Creating Roles and Permission Part 1

Hello everyone, As we all know managing user roles and permissions effectively is crucial for maintaining security and ensuring appropriate access within any organization. In this blog post, we'll delve into the user roles and permissions hierarchy at ABC company. We'll explore the different roles, their specific permissions, and how these roles interrelate to form a cohesive and secure system especially when we have multiple website with multisite setup. We will see, how we can implement this using PowerShell. Lets consider, we have a company called ABC which is having corpate website followed by Country level site. The company have below roles. The hierarchy of the Site is ABC(Tenant) --> External(Site Collection) --> IN(Site) ABC Limiter ABC Author ABC External IN Access ABC External IN Content Previewer ABC External IN Content Contributor ABC External IN Content Publisher ABC External IN Content Admin ABC External IN Site Admin Each role...

Migrate Content Between XM Cloud Environment

Image
Hello everyone. In this blog we will discuss how we can migrate content between two different XM Cloud environment. As we all know, how important it is to keep the content sync from production to lower environment. It helps to lower down the risk of error in production as testing can be done more efficiently. In traditional CMS, database restore was one of the most popular way to sync content between environments. But when we are working in XM Cloud, as we all know Its SAAS product, there we don't have control over Databases. So, how we can restore the content on lower environment in such cases? The answer is simple, through package migration. Correct? Nope, package migration is good option when we have very less content and the biggest problem is with media items. Let's see, how Sitecore Serilization helps in this process to resolve our error. We will use Sitecore CLI commands for our rescue. Step 1 : Setting up the Sitecore Serialization. Create a separate folder un...

Steps to Generate Access Token for Authoring API Endpoint in XM Cloud

Image
Hello everyone, In this blog we will understand, how to get access token which is must for interacting with Authoring API endpoint. As we all know, to work with preview endpoint in XM Cloud, we required sc_apikey which we can get from Sitecore. But we cannot use the same when working with Authoring API endpoint. We will require an access token for the same. So follow below steps to implement the same. Step 1 : Login to you XM Cloud Instance and click on XM Cloud Deploy APP. Step 2 : Click on Credentials in left side panel. Step 3 : Click on Create Credentials.A popup will come up. Fill the details as shown in below figure. Step 4 : Another popup will come up which will show you generated client id and client secret.Copy you client secret as will not be accessible once popup us closed. Step 5 : Now we are ready with client id and client secret. It's time to get the access token.Open Powershell in administrator mode and run below command.The placeholder {0} represent the clie...

Understanding Search Query With Pagination Using GraphQL In XM Cloud

Image
Hello Everyone, In this blog we will see how we can implement search query using GraphQL and implement pagination.GraphQL uses cursor based system to handle pagination whenever we execute a search query. We will see this in action. Let's understand this with a common use-case which every developers encounters. We are having Blog pages or Article pages. We want to get all blogs or articles based on some conditions. The blogs or articles should be sorted based on published date. At first, we just want to show n number of items from the result. Then on load more, we need to show the remaining items. Let's jump quickly into action. We will open GraphQL IDE and dive into writing the query. I am using local XM Cloud. Required thing to execute query. GraphQL IDE : "https://xmcloudcm.localhost/sitecore/api/graph/edge/ide" Api Key: We can get it from Sitecore instance under mentioned path. Path: /sitecore/system/Settings/Services/API Keys. In above image, it give...