Skip to main content

Posts

Sitecore CLI: Extend the Command Line Interface with NuGet

 Sitecore CLI: Extend the Command Line Interface with NuGet Sitecore Command Line Interface (CLI) allows console communication with a Sitecore instance.  Sitecore CLI allows adding commands by writing custom plugins. Sitecore provides some plugins like Publishing and Serialization. The purpose of this blog is to create a simple Sitecore CLI plugin which will print any message which you pass as parameter or print a default message. Sitecore CLI Document Sitecore Command Line Interface Prerequisites .Net Core Code Repository GitHub Usages dotnet sitecore plugin [subcommand] [options] Below are some subcommands: init subcommand add subcommand remove subcommand list subcommand Create a custom CLI plugin command Create a blank new Solution “CustomCLI” in Visual Studio, then add a class library with .Net core 3.1 with the name “CLI.DevEX.Extensibility.Custom”. PackageSources node contains all package sources. Plugin sources need to be specified in Nuget.Config, Local package source will take

WOW Got My first Sitecore Technology MVP Award

The Sitecore MVP Award celebrates the most active Sitecore community members from around the world who provide valuable online and offline expertise that enriches the community experience and makes a difference. I am pleased to announce that I have been name a " Most Valuable Professional (MVP) " by Sitecore. After working for more than 6+ years in Sitecore it was really exciting to achieve this milestone which was my dream.  I am really thankful to everyone who has supported me in this journey and guided me. More details about the Sitecore MVP Program you can find here    

Sitecore Powershell Script to Update Datasource Path In Final Rendering

Sitecore Powershell Script to Update Datasource Path In Final Rendering  In project, there was a requirement to update datasource for specific rendering so to update the rendering datasource I wrote below PowerShell script.   Function Change-RenderingDatasourceInAllPages{ Param( [Parameter(Mandatory=$true)] [String]$PagesRoot, [Parameter(Mandatory=$true)] [String]$Placeholder, [Parameter(Mandatory=$true)] [String]$DataSourcePath, [Parameter(Mandatory=$true)] [String]$ItemId ) $pages = @(get-item $PagesRoot) $pages += @(get-childitem -Path $PagesRoot -Recurse) $defaultLayout = Get-LayoutDevice "Default" foreach($page in $pages) { Get-Rendering -Item $page -Device $defaultLayout -FinalLayout -Placeholder $Placeholder | ForEach { if($_.ItemID -eq $ItemId) { $_.Datasource=$DataSourcePath Set-Rendering -Item $page -Instance $_ -FinalLayout:$True

Sitecore 10.2 ERROR: Container is unhealthy

 Error: Sitecore 10.2 ERROR: Container is unhealthy Solution: I resolved this issue by using below steps: Run docker-compose stop on Powershell. Run docker-compose down on Powershell. Run iisreset /stop on Powershell. Then run docker-compose up -d on Powershell.

Sitecore 10.2 Installation Error : "Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform"

Error:  Sitecore 10.2 Installation Error: "Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform" with Docker Solution: I have resolved this issue by turning off the option in Docker Desktop settings or use the CLI command docker-compose disable-v2 . This error usually comes when using Docker Compose V2

Add a Custom Attribute to the General External Link Field in Sitecore

Add a Custom Attribute to the General External Link Field in Sitecore I have a requirement where I want to add a custom attribute on the External Link popup just like the below image:    Below are the steps which we need to done: Core DB: Go to in core DB Go to this location “/sitecore/system/Field types/Link Types/General Link/Menu/External link” In a message field by default value is “contentlink:externallink(id=$Target)” which we need to update with this “contentlink:externallinkextend(id=$Target)”    Now click on General Link and update the “Control” field with this “content:ExtendLinks”     Create New Message Handler  using Sitecore; using Sitecore.Diagnostics; using Sitecore.Shell.Applications.ContentEditor; using Sitecore.Text; using Sitecore.Web.UI.Sheer; namespace SampleProject.Services { public class ExtendLinks: Link { public override void HandleMessage(Message message) { Assert.ArgumentNotNull((object)message, nameof(mess

Sitecore 10.2 - “Failed to start service ‘Sitecore Marketing Automation Engine’” on Windows 11

Sitecore 10.2 - “Failed to start service ‘Sitecore Marketing Automation Engine' ” on Windows 11 Today I started to install Sitecore 10.2 using Sitecore Instance Manager on Windows 11 and I got this issue “Failed to start service ‘Sitecore Marketing Automation Engine' ” . Error : On event viewer it was showing the below error: I also tried to run ‘ Sitecore.MAEngine.exe ’ like this C:\Windows\system32>C:\inetpub\wwwroot\sclocal102xconnect.dev.local\App_Data\jobs\continuous\AutomationEngine\Sitecore.MAEngine.exe Which was throwing below error: Starting Marketing Automation Engine... 2022-01-29 22:21:11 ERR Error initializing XConnect client. System.AggregateException: One or more errors occurred. ---> Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred while sending the request. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected err

Sitecore 9 Forms :  Alphanumeric Captcha

Sitecore 9 Forms :  Alphanumeric Captcha As you know Recaptcha is not available on Sitecore 9.0.1 and Sitecore 9.0.2 forms, so I thought to create custom Google Recaptcha but my issue was Google Recaptcha was not working properly on Internet Explorer as it was asking 10 to 15 times to verify which is very frustrating, at the same time it was working for another browser so I thought to create custom Alphanumeric captcha as per client requirement. In previous blog, we have checked how to create Google reCaptcha field. Now we are going to create Alphanumeric Captcha using below steps: Create new viewmodel class AlphaNumericViewModel.cs [Serializable()]     public class AlphaNumericViewModel : StringInputViewModel     {         protected override void InitItemProperties(Item item)         {             base .InitItemProperties(item);         }     }   Create Controller AlphanumericCaptchaController.cs public class AlphanumericCaptchaController