Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, October 29, 2019

Multilist in Sitecore JSS App

For the list data, Sitecore JSS offering "ContentList" as a field datatype. When you deploy it in Sitecore, it converts into "Treelist".

But what to do if you need "Multilist" instead of Treelist at Sitecore side?

Solution:
 

You have to specify "MultiList" as a string type when you define the Sitecore field definition for the component as

name: 'content'type: CommonFieldTypes.RichText },
name: 'articleList'type: 'MultiList'},

As you can notice here I defined "ArticleList" field as a "MultiList" datatype.

You can also set the datasource or query with this Multilist field definition as


name: 'articleList'type: 'MultiList'source: `query:./Articles/*`, },

Here I have set the datasource as a child folder "articles" of current Sitecore context item.

I hope this quick tip help you in Sitecore JSS App development.

Wednesday, October 23, 2019

Problem with Sitecore GraphQL on Azure

We have deployed JSS App on Sitecore instance running on Azure.

For one of the component we are using GraphQL which is perfectly working on local machine.


But when we deploy it on Azure our GraphQL query was not returning anything.

Our query was


var query = `{
search(fieldsEqual: [{name: "_fullpath",
value: "/sitecore/content/myjssproj/Content/BlogsCollection/ContentListField/*"}
])

As you can note, we have used "fieldsEqual" parameter and pass the name and value. You will get this query result on your local machine but this is not going to work on Azure.

I think this is because we are using "Azure Search" and Azure have limitation of 1000 fields index. It may be possible that Azure search not indexed system fields.

So if you want to use Azure Search with GraphQL you should rewrite your query with "rootItem" parameter as


var query = `{
search(rootItem: "/sitecore/content/myjssproj/Content/BlogsCollection/ContentListField/*"
)

Other alternative is to use SOLR as a search on Azure. I find this link is very simple and handy to install SOLR on azure.

Fix : Sitecore error - The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.

Our Sitecore website was running fine on Azure. But one day when we tried to open Content Editor, we started to receive error "The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception."

As we have to update the content urgently and our Content editor was unable to update any content, so for the time being we updated those content from "DB browser" screen by accessing https://mysc.azurewebsites.net/sitecore/admin/dbbrowser.aspx.

However this was temporary solution, we have to resolve this issue anyway.


Solution:- 

Somewhere on web I read that the cause of this type of error is temp files on server.

As our instance was running on Azure, so we updated web.config file by editing some comment in the hope that it will recycle the app pool but this trick did not worked.


Next thing we tried to "Restart" the web app and once app was up, our content editor able to access content editor and updated content successfully.


I think App service restart operation removed those temp files and fixed the issue.

Sunday, October 13, 2019

eBook : Sitecore xDB to xConnect

Sharing my new eBook with Sitecore community - "Sitecore xDB to xConnect".

You can read and download this ebook from here:



I hope you like this eBook.

Please leave your comments or share this eBook if it’s useful for you.
 

Wednesday, September 18, 2019

Enable Unicorn for Sitecore websites


Below files are required in order to enable Unicorn on any Sitecore website i.e. if you want to access http://<sitecorewebiste>/Unicorn.aspx, put below files in bin folder
  • Configy.dll
  • Kamsar.WebConsole.dll
  • MicroCHAP.dll
  • Rainbow.dll
  • Rainbow.Storage.Sc.dll
  • Rainbow.Storage.Yaml.dll
  • Unicorn.dll

Config files

  • All config files under "App_Config\Include\Unicorn" folder
  • Rainbow.config

You should make your own project sepcific config file to serialize Sitecore items using Unicorn.

For JSS App, you can create unicorn file "Include\zzz\JSS.Serialization.config" something like 

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

  <sitecore>
    <unicorn>
      <configurations>
        <configuration name="SitecoreJSSUnicorn" description="Sitecore JSS Serilization using Unicorn">
          <targetDataStore physicalRootPath="D:\Projects\MyJSSProject\Sitecore\Serialization\JSS Site Items" useDataCache="false" type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" singleInstance="true"/>
          <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true" >
            <!--Media-->
            <include name="SitecoreUnicorn.MediaOuter.JSS" database="master" path="/sitecore/media library/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>
            <!--Media-->
            <include name="SitecoreUnicorn.MediaInside.JSS" database="master" path="/sitecore/media library/Project/JSSTenant/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>           
            <!--Tempaltes-->
            <include name="SitecoreUnicorn.Template.JSS" database="master" path="/sitecore/templates/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>
            <include name="SitecoreUnicorn.Placeholders.JSS" database="master" path="/sitecore/layout/Placeholder Settings/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>
            <include name="SitecoreUnicorn.Layout.JSS" database="master" path="/sitecore/layout/Layouts/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>
            <include name="SitecoreUnicorn.Renderings.JSS" database="master" path="/sitecore/layout/Renderings/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>
            <include name="SitecoreUnicorn.Content.JSS" database="master" path="/sitecore/content/MyJSSTenant/products-myjssproject">
              <!-- <exclude children="true"/> -->
            </include>                  
          </predicate>
        </configuration>
      </configurations>
    </unicorn>
  </sitecore>
</configuration>


Friday, September 13, 2019

How to use Express Migration Tool for Sitecore 9.2

Sitecore Express Migration Tool is used to migrate from version 6.6 to 9.0 initial version. But latest version of Sitecore is 9.2.

Can you export content from any instance of Sitecore 6.6 and onwards to dircetly to Sitecore 9.2?

The answer is YES. Question is how?

So here is the trick!!!

We will use the Sitecore Express Migration Tool itself for this. We will select our needed Source Sitecore version and target Sitecore version as 9.0.0 rev. 171002 and select options to migrate as

  • Core database items
  • Master database items
  • Security
We are ONLY migrating content and NOT the files. So finally you tool screen should looks like

Step 1 in Sitecore Express Migration Tool
Step 1 : Sitecore Express Migration Tool


Click "Next" button.

This tool migrate items from one database to another database. If we compare CORE and MASTER database of earlier version with Sitecore 9.2 version. Tables number and structure is same. If you think logically, all sitecore versions have "Items" table. So it does not matter which Sitecore version are you using.


Sitecore 9.2 Vs 7.2 Database Tables Comparison
Sitecore 9.2 Vs 7.2 Database Tables Comparison

So in step 2 Source section, you can put connection string of your old Sitecore instance details but in "Target" section, you have to specify your Sitecore 9.2 related CORE and MASTER database connection string. Though we are not copying any files but still you should specify Website folder for 9.2. It will be similar to below screen

Step 2 in Sitecore Express Migration Tool
Step 2 : Sitecore Express Migration Tool


Now you can continue ahead with tool and this migration should be completed successfully.

After completion either Recycle your app pool or restart IIS.


Open your Sitecore 9.2 instance and you should get your all old Sitecore instance items in 9.2 content tree.

I have tested it on my local machine and it works like a charm.

So Happy migration!!!

Wednesday, September 11, 2019

Fixed : Access Issue while importing JSS app

If you are getting error when you fire Sitecore JSS command jss deploy app -c -d

Exception thrown while importing JSS app
Exception: Sitecore.Exceptions.AccessDeniedException
Message: AddFromTemplate - Add access required (destination: {0DE95AE4-41AB-4D01-9EB0-67441B7C2450}, template: {061CBA15-5474-4B91-8A06-17903B102B82})


Solution:-
 

Id "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}" is for "/sitecore/content" while "{061CBA15-5474-4B91-8A06-17903B102B82}" is for "/sitecore/templates/Foundation/JavaScript Services/App".
 

Basically JssImport service unable to create item under "Content" item. So this is the permission problem.

To fix it, provide access to user "sitecore\JssImport" to "Sitecore\Content" and its descendant items as


Permission to user JssImport
Permission to user JssImport

 

Monday, September 9, 2019

Install Sitecore 7.2 on Windows 10

If you want to install Sitecore 7.2 on Windows 10 having Visual Studio 2019 and SQL Server 2017. Then you need to install "ASP.NET MVC 4" from https://www.microsoft.com/en-us/download/details.aspx?id=30683 .

Once MVC 4 is in place, you should be able to install, login and access Sitecore 7.2 content tree as

Sitecore 7.2
Sitecore 7.2




Friday, September 6, 2019

How to install Sitecore 9.0 with SIF 2.1.0

As you know to install Sitecore 9.0 , you need SIF 1.2.1. But with below modifications you can install Sitecore 9.0 with SIF 2.1.0 as well. For this

  • Modify xconnect-createcert.json -> Find the CreateRootCert task -> Change the StoreLocation from CurrentUser to LocalMachine
  • Modify xconnect-solr.json and sitecore-solr.json -> Find the CreateCores task in each file -> Change the "Name" attribute in Params > Action to lowercase "name".

So now with single SIF version 2.1.0, you can install 9.0 and 9.2 instance.

Thursday, September 5, 2019

Fixed - Failed to start service Sitecore XConnect Search Indexer

If you are installing Sitecore 9/9.1/9.2, you may get xConnect services error such as

Faulting application name: XConnectSearchIndexer.exe, version: 3.0.0.0, time stamp: 0xf3556d61
Faulting module name: KERNELBASE.dll, version: 10.0.18362.1, time stamp: 0x1a30e11b
Exception code: 0xe0434352
Fault offset: 0x000000000003a839
Faulting process id: 0x1dd8
Faulting application start time: 0x01d563cefdbb60d1
Faulting application path: C:\inetpub\wwwroot\habitathomecorporate_xconnect.dev.local\App_Data\jobs\continuous\IndexWorker\XConnectSearchIndexer.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: bee07631-f2fa-48b6-9307-b4296f68ff50
Faulting package full name:
Faulting package-relative application ID:


Solution :-

I follow below steps and its solved my issue
  • Close all PowerShell window
  • Remove any existing "DO_NOT_TRUST_SitecoreRootCert" certificate from your machine
  • Provide "Full Permission" to "Everyone" to folder "c:\resourcefiles"
  • Provide "Full Permission" to "Everyone" to folder "C:\inetpub\wwwroot.

Try again to install the Sitecore and you should get your instance up now.

I hope this solution helps other in similar situation.

Thursday, August 15, 2019

Why to upgrade Sitecore from 8.2 to 9.2

If you are running any Sitecore website in 8.x, then start to plan on its upgradation. 

Question is Why? 

Well, first thing is that mainstream support of Sitecore version 8.2 is going to end in 31st Dec 2019. However extended support will be avilable upto 31-Dec-2022. But remember there will be cost associated for providing any patch, hotfixes, DLL or development defects solution during this extended period by Sitecore.

Second MongoDB 3.4 is generally used for Sitecore 8.2 and bad news is that MongoDB 3.4 will also end its support in Jan 2020.

So I will suggest to all clients, sitecore license holders to upgrade their projects from 8.2 to latest version of Sitecore 9.2. Sitecore 9.2 comes with cutting-edge features.

Just a note Sitecore 9.2 Mainstream Support will be available upto 31st Dec 2022.

Wednesday, August 14, 2019

Certificate : Installing Sitecore XP0 9.2

Though not a big deal, but I have one hour of time and I utilize it to complete the course "Installing Sitecore® XP0 9.2" from Sitecore elearning.

Here is the certificate for the same.

 Installing Sitecore XP0 9.2
 Installing Sitecore XP0 9.2

Tuesday, August 13, 2019

Certificate : Fast-Track Design in Sitecore Experience Accelerator 9.2

Today I continue my SXA journey, completed the course "Fast-Track Design in Sitecore® Experience Accelerator 9.2" from Sitecore elearning.

Here is the certificate for the same.

Fast-Track Design in Sitecore® Experience Accelerator 9.2
Fast-Track Design in Sitecore® Experience Accelerator 9.2

Monday, August 12, 2019

Certificate : Introduction to Sitecore Experience Accelerator 9.2

Today I get started to familiar myself with Sitecore SXA. For this I choose two courses from elearning and completed one of them. I received certificate for course "Introduction to Sitecore Experience Accelerator 9.2" after completion of this course.

Here is the certificate.

 
Introduction to Sitecore Experience Accelerator 9.2
Introduction to Sitecore Experience Accelerator 9.2

 

Friday, August 9, 2019

Certificate : Sitecore JSS Fundamentals 9.2 certificate

I just love the Headless concept of Sitecore with full OmniChannel capabilities. To make myself more comfortable with JSS, I just completed Sitecore JSS certification by completing the course "Sitecore® JSS Fundamentals 9.2" from https://elearning.sitecore.net .

Here is the certificate for the same.

Sitecore JSS Fundamentals 9.2 certificate
Sitecore JSS Fundamentals 9.2 certificate

Friday, July 26, 2019

Certificate : Getting started with Managed Cloud Sitecore 9.2

Sitecore 9.2 is out and all Sitecorians around the world ready to play with it. I welcome Sitecore 9.2 with installing it on my laptop and completing the course "Getting started with Managed Cloud Sitecore® 9.2" from https://elearning.sitecore.net .

I come to know about many new things regarding Sitecore cloud managed services.

Here is the certificate for the same.




Certificate : Getting started with Managed Cloud Sitecore 9.2
Certificate : Getting started with Managed Cloud Sitecore 9.2


Looking forward to complete more new courses in upcoming days.

Thursday, July 18, 2019

Get all Sitecore page items only by using PowerShell script

We got the requirement to create report of all the items which are accessed by URL i.e. report of all page items.

A simple solution, for this, is to check is rendering exist on the an item or not?
If rendering exists, it means layout and components are assigned on that item. If rendering is empty, it means no layout or no component exists on that item.

You can write a C# code for generating such report but I think PowerShell is the best way to do this.

Here is the one line script for the same

Get-childItem -Path "master:\sitecore\content\home" -Recurse | Where-Object { ($_.__Renderings -ne "") } | Show-ListView -Property id, name, itempath

With this one line you can imagine the power of PowerShell. 

I strongly recommend to brush up your scripting skill.

Friday, July 12, 2019

Webinar on Voice based search with Sitecore GraphQL

I conducted webinar on "Voice based search with Sitecore GraphQL" for SUGNCR group today.

Sample code for this demo is available at  https://github.com/alexksharma/VOICE-BASED-SEARCH-WITH-SITECORE-GRAPHQL

 Watch recording for more details









Friday, July 5, 2019

Fixed: Rebuild Reporting Database failed in Sitecore


We are using Sitecore 8.2 and our analytics data is stored in MongoDB database. Its size is around 50 GB.


From few days, we were not getting data in Sitecore analytics reports so we decided to rebuild reporting database.


We started rebuilding activity, but it fails on 8th days. We tried again, and same thing happen and failed on 8th days.


We started to investigate why its failing specially on 8th days?


Solution:


There is a config setting <TaskEntryAfterLife> in file "Sitecore.Analytics.Processing.config" which by default set for 8 days. 

<!-- TASK ENTRY AFTERLIFE
  Specifies the minimum time a task entry (and all associated data structures) is kept in the task queue after
  the task has executed.
 
  Default: 8.00:00:00
-->
<TaskEntryAfterLife>8.00:00:00</TaskEntryAfterLife>

We changed its entry for 15 days as

<!-- TASK ENTRY AFTERLIFE
  Specifies the minimum time a task entry (and all associated data structures) is kept in the task queue after
  the task has executed.
 
  Default: 8.00:00:00
-->
<TaskEntryAfterLife>15.00:00:00</TaskEntryAfterLife>

After this we again started rebuilding activity and this time it works fine and completed the task on 10th days.


Now we are getting missing data in Sitecore analytics reporting sections.

I hope it helps you to fix the similar issue.

Stay tuned for more such tips and tricks.