Surendra Sharma

Surendra Sharma

Search This Blog

Showing posts with label JSS. Show all posts
Showing posts with label JSS. Show all posts

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?


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, 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="">

        <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" >
            <include name="SitecoreUnicorn.MediaOuter.JSS" database="master" path="/sitecore/media library/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.MediaInside.JSS" database="master" path="/sitecore/media library/Project/JSSTenant/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.Template.JSS" database="master" path="/sitecore/templates/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.Placeholders.JSS" database="master" path="/sitecore/layout/Placeholder Settings/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.Layout.JSS" database="master" path="/sitecore/layout/Layouts/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.Renderings.JSS" database="master" path="/sitecore/layout/Renderings/Project/products-myjssproject">
              <!-- <exclude children="true"/> -->
            <include name="SitecoreUnicorn.Content.JSS" database="master" path="/sitecore/content/MyJSSTenant/products-myjssproject">
              <!-- <exclude children="true"/> -->

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})


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


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 .

Here is the certificate for the same.

Sitecore JSS Fundamentals 9.2 certificate
Sitecore JSS Fundamentals 9.2 certificate

Wednesday, June 12, 2019

Search in Sitecore JSS

Happy to share that SUGCON India 2019 videos are published on Youtube. I conducted session on "Search In Sitecore JSS". I am sharing here recorded session on the same.

Friday, January 11, 2019

Batch file to create empty app from Sitecore JSS boilerplate app

If you are new to Sitecore JSS app and want to develop any website from it, then best place to start working on this is to restore sample Sitecore JSS app.

Default Sitecore JSS app comes as boilerplate.

Understand how it is functioning and how to write the code. Once you understand sample app, then remove all the default sample content (the Styleguide and GraphQL files) from below paths:

1.            Delete /src/components/Styleguide* and /src/components/GraphQL*
2.            Delete /sitecore/definitions/components/Styleguide*, /sitecore/definitions/templates/Styleguide*, and /sitecore/definitions/components/GraphQL*
3.            Delete /data/component-content/Styleguide
4.            Delete /data/content/Styleguide
5.            Delete /data/routes/styleguide and /data/routes/graphql
6.            Delete /data/dictionary/*.yml

If you like you can remove these files and folders manually. To make your life easy, I have created a batch file which remove all these contents and give you perfect empty app in just two click. 

Just copy the batch file in your JSS application root directory as "CleanupApp.bat" and run it.

Sitecore JSS App clean up batch file
Sitecore JSS App clean up batch file

Batch file looks like

REM Batch file to remove all of the default sample content (the Styleguide and GraphQL routes)

FOR /D %%p IN (".\src\components\Styleguide*") DO RMDIR "%%p" /s /q
FOR /D %%p IN (".\src\components\GraphQL*") DO RMDIR "%%p" /s /q

DEL /q ".\src\components\Styleguide*"
DEL /q ".\sitecore\definitions\components\Styleguide*"
DEL /q ".\sitecore\definitions\components\GraphQL*"
DEL /q ".\sitecore\definitions\templates\Styleguide*"

FOR /D %%p IN (".\data\component-content\Styleguide") DO RMDIR "%%p" /s /q

FOR /D %%p IN (".\data\content\Styleguide") DO RMDIR "%%p" /s /q

FOR /D %%p IN (".\data\routes\styleguide") DO RMDIR "%%p" /s /q
FOR /D %%p IN (".\data\routes\graphql") DO RMDIR "%%p" /s /q

DEL /q ".\data\dictionary\*.yml"

That’s it.