Thursday, June 22, 2023

List Manager not showing any list in sitecore

 Hello Friends,


Issue :  Created a list  in List Manager, it shows successfully created but when we go back to List Manager we do not see any Lists.


Solution : Please check if your Master index is rebuild properly or not.


Hope you enjoy these simple solutions. 

Control Panel Rebuild Index shows no Index name

 When we go to Control Panel and click on Rebuild Index, we will not see any indexes for rebuilding.


Fix :  Please check SOLR connectionstring

e.g. If it is mentioned like this

https://preprod1-solr.quintilesstudy.com:8983/solr/

then change it to 

https://preprod1-solr.quintilesstudy.com:8983/solr


After that when you refresh the sitecore and go to Control Panel and  click on Rebuild Index you will see the indexes will be present.



Tuesday, November 9, 2021

Sitecore Interview Questions

 Sitecore questions often asked 


1)  How you can remove ashx extension from media file and add actual extension?

<!-- MEDIA - REQUEST EXTENSION The extension to use in media request URLs. If the value is not set, the Extension field of the individual media items will be used (ie. JPG, GIF, etc.) Default value: "ashx" -->
<setting name="Media.RequestExtension" value="ashx"/>


2) Sitecore Pipeline

public class RemoveDuplicateItems : PublishItemProcessor
    {
        Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId);
        if (sourceItem != null)
        {
            Item targetItem = context.PublishOptions.TargetDatabase.GetItem(sourceItem.Paths.Path);

            if (targetItem != null && targetItem.ID != sourceItem.ID)
            {
                context.PublishHelper.DeleteTargetItem(targetItem.ID);
            }
        }
    }


3) Data Exchange Framework : Can be used to transfer data between third parties.


Monday, July 26, 2021

Sitecore user unlock

 

  • Open website\sitecore\admin\unlock_admin.aspx page.
  • Open aspx page in the text editor and replace the following line:


    GetUser("sitecore\\admin").UnlockUser();​

With:

 

var user = Membership.GetUser("sitecore\\admin");

user.UnlockUser();

user.ChangePassword(user.ResetPassword(), "b");

Friday, June 4, 2021

Issue: Could not find configuration node: databases/database[@id='stresstest_web'] while seeing presentation details in StressTest_Web publishing target

 Server Error in '/' Application.

Could not find configuration node: databases/database[@id='stresstest_web']
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find configuration node: databases/database[@id='stresstest_web']


Solution : I have observed that in config there were configuration setup done in upper case (StressTest_Web),lowering the case resolved the issue.

<database id="StressTest_Web" type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel" singleInstance="true" >


Thursday, April 1, 2021

Sitecore SXA

 Sitecore SXA Media


Different tokens used in SXA:

The resolveTokens pipeline is used to resolve tokens that can be used in queries. For example:

  • $compatibleThemes - path to all themes.

  • $theme - currently used theme.

  • $pageDesigns - root of page designs (sitecore/content/Tenant/Site/Presentation/Page Designs).

  • $partialDesigns - root of partial designs (/sitecore/content/Tenant/Site/Presentation/Partial Designs) .

  • $currenttemplate - name of the current template.

  • $tenant - path to the current tenant.

  • $site - path to the current site.

  • $home - path to the current site start item (by default: /sitecore/content/Tenant/Site/Home).

  • $linkableHomes - paths to home items from linkable sites.

  • $templates - path to the current site templates (/sitecore/templates/Project/Tenant).

  • $siteMedia - paths to media folders specified in Additional Children field on virtual media folder item.

  • $sharedSites - for multiroot fields, resolves shared site for the current tenant.

  • $rvSystemTemplates - list of templates defined in a configuration. These templates are used to feed the AllowedInTemplates field for rendering variants.

  • $xaRichTextProfile - the XA.Foundation.Editing.DefaultRichTextProfile setting value.

By adding new processors to this pipeline, you can design new tokens.

This pipeline is defined in the Sitecore.XA.Foundation.TokenResolution.config file and includes the following processors:

Processor

Description

CurrentTemplateToken

Determines the current tokens used.

EscapeQueryTokens

Used to escape tokens that are used in Sitecore queries.


Configure the Media Library for an SXA site:
Whenever you add a site through Site creation wizard, following media item get created:
  1. <<SiteName>>
  2. shared
Please see below screenshot for reference:





note: if you see the path of this folder it will be of media library.

Thus in simple words we can say that it makes easy for content editor to search images related to particular site in very easy way.

If you want to add images from global folder which is shared across sites then you can do it easily over here by adding that shared image folder in Additional Children Field as shown below.





Thursday, March 25, 2021

Sitecore JSS Step By Step

 Sitecore JSS step by step


There are  two different approaches by which you can create your application using sitecore JSS.

1) Code First   2) Sitecore First


Sitecore integration and data flow

Let's start with some practical. To create JSS application please follow below steps:

1) Download and Install Node.js


2) Install Sitecore JSS CLI

 2.1) Run below command in command prompt to install sitecore JSS.It will take couple of minutes.
       
           npm install -g @sitecore-jss/sitecore-jss-cli
 2.2) you can check which version of JSS got installed using below command.
           jss --version

3) Create JSS Application, I am using react.js here for same.
 
     Run below command 
       Syntax:      jss create <<your application name>> <<application template name >>
    
              jss create jss-demo react

4) Start sitecore JSS Application
  
Go to jss-demo folder which we created in step 3 and run below command
      jss start
5) Create a new component

   5.1) Open Windows powershell  and run below command
           jss scaffold Mycomponent
Note:- Component name should always begin with Capital Letter and contain only letters and numbers.
   some time you see below error
jss : File C:\Users\admin\AppData\Roaming\npm\jss.ps1 cannot be loaded. The file
C:\Users\admin\AppData\Roaming\npm\jss.ps1 is not digitally signed. You cannot run this script on the current system.
For more information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ jss scaffold Myfirstcomponent
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

   for time being you can run below command to resolve above issue.check it with your security team later on this.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

after this command, run again jss scaffold Mycomponent it will work fine.

5.2) In source code folder, go to Sitecore -> defination-> component ->Mycomponen.sitecore.js.In the field section,add all the required fields as shown below,
  
source code:
    // eslint-disable-next-line no-unused-vars
import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';

/**
 * Adds the Mycomponent component to the disconnected manifest.
 * This function is invoked by convention (*.sitecore.js) when 'jss manifest' is run.
 * @param {Manifest} manifest Manifest instance to add components to
 */
export default function(manifest) {
  manifest.addComponent({
    name: 'Mycomponent',
    icon: SitecoreIcon.DocumentTag,
    fields: [
        { name: 'heading', type: CommonFieldTypes.SingleLineText },
        { name: 'headingDescription', type: CommonFieldTypes.RichText },
    ],
    /*
    If the component implementation uses <Placeholder> or withPlaceholder to expose a placeholder,
    register it here, or components added to that placeholder will not be returned by Sitecore:
    placeholders: ['exposed-placeholder-name']
    */
  });
}

5.3) open en.yml file which is located in following location ( ~/data/routes/en.yml),you will see placeholder section,add your placeholder as shown below:

placeholders:
  jss-main:
  - componentName: Mycomponent
    fields :
     heading : This is my first component
     headingDescription : <h1> Please comment </h1>

please note that there should not be any error in console.

5.4) Please change your MyComponent index file which is located at src/components/mycomponent/index.js based on the fields which you need to show as shown below

Source code:
import React from 'react';
import { RichText, Text } from '@sitecore-jss/sitecore-jss-react';

const Mycomponent = (props) => (
  <div>
        <Text field={props.fields.heading} /><br />
        <RichText field={props.fields.headingDescription} />
  </div>
);

export default Mycomponent;

6) Test newly created component
         you will see the changes in your browser as i have added it in jss-main placeholder.
  
some time if you see build error as shown below

Failed to compile
src\components\Myfirstcomponent\index.js
Line 1:27: Insert `␍` prettier/prettier
Line 2:67: Insert `␍` prettier/prettier
Line 3:1: Insert `␍` prettier/prettier
Line 4:38: Insert `␍` prettier/prettier
Line 5:8: Insert `␍` prettier/prettier
Line 6:1: Replace `········<Text·field={props.fields.heading}·/><br·/>` with `····<Text·field={props.fields.heading}·/>␍⏎····<br·/>␍` prettier/prettier
Line 7:1: Replace `········<RichText·field={props.fields.headingDescription}·/>` with `····<RichText·field={props.fields.headingDescription}·/>␍` prettier/prettier
Line 8:9: Insert `␍` prettier/prettier
Line 9:3: Insert `␍` prettier/prettier
Line 10:1: Insert `␍` prettier/prettier
Line 11:33: Insert `␍` prettier/prettier

then do following steps to resolve this issue
i) create .eslintignore file in your source folder
ii) open it using editor and write  following line
src/*

7) Lets deploy the JSS Application into sitecore 

7.1)  go to sitecore-> config folder ,you will see site patch as shown below:
      
         <site patch:before="site[@name='website']"
            inherits="website"
            name="jss-demo"
            hostName="jss-demo.dev.local"
            rootPath="/sitecore/content/jss-demo"
            startItem="/home"
            database="master" />

add binding in sitecore instance where you want to deploy jss application and make sure to add host entry.

7.2) Create a new API Key under /sitecore/system/Settings/Services/API Keys,keep new api key handy as it is needed in next step.

7.3) Run jss setup as shown below,give answer to questions appropriately. below image is just for sample. Give answers to questions based on how you setup.

you will see a new file got generated scjssconfig.json
 
{
  "sitecore": {
    "instancePath": "C:\\inetpub\\wwwroot\\sitecorejssdemosc.dev.local",
    "apiKey": "{E5094782-ED97-4E91-89D5-E26DBEE86EB2}",
    "deploySecret": "30j8k1xv53ea50hgo5ter4yuars0fczkqdsfk0st1s7k",
    "deployUrl": "http://jss-react-demo.dev.local/sitecore/api/jss/import",
    "layoutServiceHost": "http://jss-react-demo.dev.local"
  }
}

7.4) In windows powershell type jss deploy config
7.5) In windows powershell type jss deploy app --includeContent --includeDictionary
sitecore import service will deploy the application in sitecore.It will create all required item in sitecore.
7.6) Open sitecore instance,you will be able to see new component which we created.



8) Test Home item in experience editor mode

8.1) Click on Home tab and open it in sitecore experience editor.
8.2) Edit the conent in experience editor and save it.

9) Run JSS application in connected mode

type following command  to run it in connected mode.

jss start:connected










List Manager not showing any list in sitecore

 Hello Friends, Issue :  Created a list  in List Manager, it shows successfully created but when we go back to List Manager we do not see an...