Sunday, August 20, 2017

Useful Extra Settings to be used with Multi-Site Clones

Recently we worked on a Sitecore solution where Clones are in multi-site scenario with each site have its own home node. So, for example, blogs that are created in global Home node is migrated to country home nodes.

Force Update on Clones

One major option that was useful in this scenario was Auto Accepting changes done to the source item in clones. Otherwise editors have to go into clone items and accept changes if any modification done to the source items.

This feature was added to most recent releases by default, but some older releases needs code implementation to get this functionality to work. Following article in Sitecore knowledge base explains this.

The setting which should be enable displays below

<setting name="ItemCloning.ForceUpdate" value="true"/>  

Inherit Workflow State to Clones

Next important setting to be set was making the clone items inherit the workflow status from the source item. This should be set to true to prevent any unwanted items getting published to publich website. In my opinion, this setting should be set to true by default by Sitecore.

<setting name="ItemCloning.InheritWorkflowData" value="true"/> 

Delete Clones when Original Item Deleted

Setting this one depends on your project requirement. But, in our scenario we didn't wanted to keep the clones when original items were deleted. So, we set the following setting to true.

<setting name="ItemCloning.DeleteClonesWithOriginalItem" value="true"/> 

Relink Clones to Its Sub Tree

This is also an important setting to be set to true. When in a multi-site scenario with multiple home nodes for each site, it is NOT enough to just clone the items into country nodes. Those item links should also be pointing to its own home node paths.

By default this setting is set to false. We enabled it in our site

<setting name="ItemCloning.RelinkClonedSubtree" value="true" />

Tuesday, March 21, 2017

Preview Site Not Pickup Correctly In Multi-Site Setup For Preview OR Experience Editor On Sitecore 8 Versions

Recently I was working on a project where we converted the existing single site setup into multi-site setup.

After the conversion to multi-site setup, there were few issues reported related to local site settings were not pick-up correctly. Following are the few issues reported

Issue 1 :

When try to open Experience Editor from Sitecore Launch Pad, it didn't open the correct local site, but open the Eperience Editor for default site (i.e. "website")


This was mention on several articls and the solution was to

1) Open the “/sitecore/client/Applications/Launchpad/PageSettings/Buttons/ContentEditing/ExperienceEditor” item in the core database
2) Change the “Link” field value to: /?sc_mode=edit&sc_resolvelanguage=0

Issue 2 :

When try to open the Experience Editor for an item from Content Editor, it always set the "sc_site" parameter to "website". So, it also was not picking-up the correct context site.



Sitecore has reported this as a known issue and has provided fix in the following knowledge base article.

In multi-site Sitecore solutions, the Preview functionality of the Content Editor or Page Editor may incorrectly resolve the site the previewed item belongs to.The context site may be resolved according to the value of the Preview.DefaultSite setting, or set to website as default.

After the above fix is implemented, site context site resolved correctly.


Friday, March 3, 2017

My First Major Sitecore PowerShell Extension Workout

One of my recent tasks was to make a content node with child items to fallback to "en" language version, for all existing languages.

Since there were lot of child items, I thought to use the Sitecore PowerShell module and do it using script.

Sitecore PowerShell Extension module can be downloaded from

During my task, I faced several obstacles. But all solved using PowerShell scripts.

First thing I did was Google..

I found following article, which contains most of the functionality I needed.

Then, I needed to restrict the code to only change workflow state on all the language except "en" language.

I posted my question on Sitecore Slack Chat in #module-spe channel.

(In case if you are not yet a member of Sitecore Chat channel, you can send a request to access it using )

Luckily, Sitecore PowerShell module creates was on Sitecore Slack Chat Channel also. They helped with that problem.

get-childitem . -recurse -Language * | where-object { $_.Language -ne "en" }

Then, I faced another strange issue. When run the following script, it only returned few language versions per an item. But, I know there were lot of other language versions for this same ite.

get-item . -Language * | Format-Table Id, Name, Language, __Workflow, "__Workflow state", "__Default workflow"

What I find out was, we are using Sitecore "Language Fallback" feature on these items. When that "Language Fallback" checkbox is checked, it somehow only took few item versions.

But, No problem. I ran following script on the child items, which sets the "Enable Item Fallback" checkbox Un-Checked. Then run the scripts. Then again make the "Enable Item Fallback" checkbox Checked.

Another Issue I faced was, when I try to remove language versions from an item, the script didn't do anything.

That is also caused by the Language Fallback feature. So, When you are running version related scripts (EX: Checking the language versions, Removing language versions, etc), first make the "Enable Item Fallback" Un-Checked, before running the Script.

From todays experience with Sitecore PowerShell Extension module, I understand that it is a must have tool for Sitecore Developers.

I will post more about the things I learn with PowerShell Extension in coming days.

Happy Sitecore and Sitecore PowerShell :-)

Sunday, February 26, 2017

My Footsteps On Configuring Sitecore Publishing Service 2.0

Recently I was task with configuring the latest Sitecore Publishing Service 2.0 into an existing Sitecore 8.2 environment. Following are the few points that I thought good to mention from my experience.

You can download the software and documentation with all the information from following link

After downloading, I installed the Pre-requisit of Windows Server Hosting (.NET Core) into the machine.

Then I followed the "Scripted Installation" option described in the documentation. It was much easier than the manual installation and provided lot of easy options.

Few points from my setting-up experience mention below.

1) Setting-up Connection Strings

For example, I ran the following command to setup 'Core' connection string

$ Sitecore.Framework.Publishing.Host configuration setconnectionstring core '<your_connection_string>' 

This will setup connectiong string on following file

Note that, it will automatically add "MultipleActiveResultSets=True;" to your connection string to support Multiple Active Result Sets (MARS).

2) Adding support to Multiple Active Results Sets on Sitecore Installation Connection Strings

To support Mutiple Active Result Sets (MARS) you have to add "MultipleActiveResultSets=True;" to end of your connection strings in your Sitecore installation.

i.e. to <Sitecore_Website_Root>/App_Config/ConnectionStrings.config

  <add name="core"  connectionString="Integrated Security=true;Data Source=(local);Database=sitecore_core822;MultipleActiveResultSets=True;" />
  <add name="master"  connectionString="Integrated Security=true;Data Source=(local);Database=sitecore_master822;MultipleActiveResultSets=True;" />
  <add name="web"  connectionString="Integrated Security=true;Data Source=(local);Database=sitecore_web822;MultipleActiveResultSets=True;" />

3) Remember to do IIS Reset for Publishing Service Website Once you do any Configuration Updates 

Not like Sitecore, you will have to do IIS Reset for Publishig Service Site to make your Configuration changes in Sitecore Publishing Service Website to take effect. 

Thursday, November 24, 2016

Custom Sitecore Command to Disable or Hide Full Publish Menu Option in Sitecore Content Editor

Recently there was a question raised in Sitecore StackExchange site related to disable Full-Publish option in Sitecore Content Editor for all the Editors access the Content Editor, including Administrator users.

Refer original question

So, basically question was that hide the "Publish site" option for all the users including Sitecore Administrators, from Content Editor.

There were some good suggestion/answers and a suggestion that I didn't agree.

One option was to set permission on menu item in Core database (i.e. /sitecore/content/Applications/Content Editor/Menues/Publish) will not solve this issue since permission will not effect Administrator users.

 Another option suggested was to delete the Full publish menu item from Sitecore Core database (i.e. /sitecore/content/Applications/Content Editor/Menues/Publish). If there is no other way, this is the final option.

I learned today by a Sitecore friend (Kamruz) that there is another way to achieve this. That is by using Sitecore Rules Engine. You can refer following post for more info

I had a look into this and created a custom Sitecore command to provide more flexible option for this issue.

First I looked into the Sitecore code related to system:publish command which was associated with this "Site publish" menu item and adjust it to support few options which can be changed using config setting.

Basically this will provide you with a Sitecore setting which you can adjust by changing config include file, with options to

  1. Run the default sitecore publishing operation
  2. Display a warning message and ignore the publishing
  3. Hide the menu item from Content Editor

How to Configure the Custom Command

Step 1:

Copy the code dll (i.e. SitecoreFootsteps.Modules.CustomEditorFullPublishOption.dll file) into <website_root>/bin folder

Code :

Step 2:

Place the following Config include file in your includes folder

<configuration xmlns:patch="">
      <command type="SitecoreFootsteps.Modules.CustomEditorFullPublishOption.CustomCommand.CustomFullPublish,SitecoreFootsteps.Modules.CustomEditorFullPublishOption" name="scfootsteps:customfullpublish"/>
      <!-- values : 
        enabled : works as default sitecore publishing
        disabled : display warning message and doesn't trigger publishing
        hidden : hide the full publish option
      <setting name="SitecoreFootsteps.EditorFullPublishOption" value="enabled" />

Step 3:

Adjust the publish menu item in Core database to point to newly define custom command

Open "/sitecore/content/Applications/Content Editor/Menues/Publish" item in Core database from Content Editor
Change "Message" field value to "sitecorefootsteps:customfullpublish"

Thats it. Custom publish command is now configured and should be working.

Following are the senarios and how command behaves

Senario 1:  SitecoreFootsteps.EditorFullPublishOption setting set to "enabled"

This will work as Default Sitecore full-publish option

Senario 2: SitecoreFootsteps.EditorFullPublishOption setting set to "disabled"

This will display a warning message and skip the full-publish when "Site publish" menu item is clicked

Senario 3: SitecoreFootsteps.EditorFullPublishOption setting is set to "hidden"

This will hide the "Site publish" option from Content Editor menu

You can find the code shared in my github repository :

Happy Sitecore!!

Tuesday, November 15, 2016

How to Add Items into a Queue and Package them Together

Recently, one of my previous colleagues told me that he is planning to create a module which can be used to stack-up items in to a list and later create a package from those listed/added items.

But, I remember one of the features showed by Michael West and Adam Najmanowicz in "Sitecore Powershell Extension Workshop" at Sitecore Symposium. That was the possibility first add Sitecore items into a list and later create a Sitecore Package using that list.

The same functionality that my colleague was thinking about.

So,  following is that functionality that you can see in Sitecore Powershell Extension module.

I have Sitecore 8 instance with Sitecore PowerShell Extension 4.2 module ( installed.

Now when I right-click on an Sitecore Item, in "Scripts" -> "Packaging" menu, you can see, "Start New Package" menu item (refer below image).

Then, when I right-click on any other Sitecore Item, it will provide "Add Item to Package" option. This option will allow you to add new items to the above created package.

And if you wish to create a new package, ignoring the previous created package, then you can select "Start New Package" option in the menu.
Please note that, this will dump your previous created package and the items added to it from memory and will create a new Package fresh.

When you are done with selecting items into package, you can click "Download Package" option in the menu. It will provide you with the Sitecore Package information dialog box.

and once submitted create and allow you to download the package

Other than those options, Sitecore Powershell Extension comes with other useful functionalities.

"Add Tree to Package" - will add the full sub-tree underneath the selected item into package
"Quick Download Tree as Package" - will directly download selected item and its sub-items as an sitecore package (Note that this option will not consider any Packages you have started. It just works on currently selected item and its sub-items)

It will turn out to be a very useful feature in your day-today Sitecore work and surely will save some time.

November Meetup - 2016 - Sitecore User Group Sri Lanka

Its time for another Sitecore Meetup in Sri Lanka. "November Meetup - 2016"

This time, we are going to focus more on the basics of .NET development and UI/UX development. Though these topics are not directly related with Sitecore, those are great knowledge to have for any Sitecore developer.

Our presenters for this meetup is Pasan Samarakoon and Lakshman Palitha.

In the first session, Pasan will talk about new ASP.NET Core framework. Pasan is a Microsoft Certifield Developer with over 5 years of .NET development experience and currently works as a Senior Software Engineer (Sitecore) at Codehouse Ltd, one of the Sitecore Partners in Sri Lanka.

In the second session, Lakshman will talk about UI and UX development. Lakshman is a web developer with over 6 years of web design and development experience. He currently works as a Senior UI Developer at Codehouse Ltd.

Meetup Link :
Facebook Event :