Pages

15 January, 2022

Sitecore site definition viewer admin page

I wrote a blog about Sitecore site definition inheritance here. To view the Site definition properties after it inherits the properties from the parent site definition, I created a very simple admin page. 😊 
  • This admin page can be simply deployed to the /sitecore/admin folder. 
  • There is no custom assembly needed. 
  • Similar to other admin pages, this page can be accessed only if the user is an admin and authenticated. 
You can download it here.  



14 January, 2022

Bug: Sitecore workflow check-in command behavior

Our Sitecore client provided a scenario related to workflow check-in command. 

  1. A template consists of different fields and few fields are having field validation.
  2. Non-admin content authors creates a item using this template.
  3. Enters the data for few fields and leaves the field with error which has field validation.
  4. Without saving the item explicitly, user directly executes check-in command which in-turn opens the dialog whether the user wants to save the changes (yes), then user gets another dialog to mention the errors in the field (yes) and item gets checked-in. 

Result: Item is checked-in but entered field values are lost. A warning dialog says that Item is locked. 

If an admin user follows the same steps, user will be able to save successfully. Since admin user can edit any item even if it is locked by another user, this is possible. 

Workaround: If the non-admin user saves the item explicitly before execute the check-in command, Sitecore will allow you to save the item with errors. 

Possible problem: The order in which the action executes might be causing this problem. Save, Check-in, Field Validation.

Sitecore support registered this as a bug and provided 515662 as the reference number.


12 January, 2022

Sitecore site definition inheritance supports single level only

Sitecore Html cache was not working even though cacheHtml attribute in site definition and caching.Enabled setting were true. Our site uses site definition inheritance. cacheHtml attribute was true in the parent's parent site definition. 

Background on inherit attribute: Sitecore can inherit the site definition properties from another site definition. It is available for quite a while but it has been prominent after JSS site definition template uses it. 

As per Sitecore's comments in Sitecore.config file: 

inherits: Indicates that the attributes should be inherited from another site. To enable inheritance, you must specify the name of the source site. Attributes that are explicitly specified overwrite the attributes that are inherited from the source site.

As per stackexchange, there is no easy way to check the final Site definition after inheritance. Michael West (@MichaelWest101) posted a Sitecore PowerShell script to check it. As per the comment in the post, Sitecore gets the inherited properties from the immediate parent site definition. There is no logic to get it from the multi level site definition inheritance. 

After we added the cacheHtml attribute to the immediate parent site definition, caching started to work. It is clear that only the immediate parent attributes will be inherited to the child child definition.  

   <sites>
      <site inherits="website"
            name="custom-common"
            cacheHtml="true"
            language="en"
            .......
            patch:before="site[@name='website']"/>    

      <site inherits="site1"
            name="site1"    
            rootPath="/sitecore/content/site1"
            startItem="/home"                    
            patch:before="site[@name='custom-common']"/>

      <site inherits="site2"
            name="site2"    
            rootPath="/sitecore/content/site2"
            startItem="/home"                    
            patch:before="site[@name='custom-common']"/>
    </sites>

04 January, 2022

Sitecore xDB Index Rebuild - Stuck at Finishing stage with 95% completion

In a Sitecore Managed Cloud instance, I started to rebuild the xDB Index. 

  • I opened Kudu console of xxx--xc-search App Service. 
  • Changed folder to "D:\home\site\wwwroot\App_Data\jobs\continuous\IndexWorker". 
  • Ran .\Sitecore.XConnectSearchIndexer.exe -rr (or .\Sitecore.XConnectSearchIndexer.exe -requestrebuild).
After waiting for a long time, I checked the status of the rebuild and it was stuck at the stage "Finishing" with 95% completed. I restarted the rebuild again and same results after several hours. In my local machine, it has completed without any problem. 

To check the status of the rebuild in Sitecore 10, you can run .\Sitecore.XConnectSearchIndexer.exe -rm (or .\Sitecore.XConnectSearchIndexer.exe -rebuildmonitor).

Downloaded the entire application content (D:\home\site\wwwroot\App_Data\jobs\continuous\IndexWorker) and compared it with local setup. I could see a different setting for Solr Writer - MaximumCommitMilliseconds in "IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexWriter.SOLR.xml". It was 600000 in Managed cloud setup. I changed it to 1000 and started the rebuild. After several hours, it completed successfully. 

If the Sitecore solution depends on Real Time xDB updates, then we should have default value which is 1000 or near to it. Our solution is not dependent on xDB real time updates but we kept it to default to make sure our rebuild process completes. This KB page explains the reason for updating the setting. 

Rebuild stages:

Default

No index rebuild is requested or running.

RebuildRequested

The index rebuild is requested but has not started yet.

Starting

The index rebuild is in the preparation stage.

RebuildingExistingData

The existing xDB collection data is being extracted and re-indexed.

RebuildingIncomingChanges

Data added during the previous stage is being indexed.

Finishing

The post-rebuild steps are being performed.

Finished

The index rebuild activities have finished.

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }