Posts

Showing posts from September, 2022

Sitecore - Task Schedulers and how to schedule a task

Image
Hey ,  there! Welcome to "Sitecore Series" Post is all about sharing the details about "Sitecore Schedulers and how to create and use Schedulers". There are scenarios, where we want a particular task to be executed after some time intervals like for each 15 mins or for each 3 hrs etc.., Below are some sample scenarios: 1) To create a items in CMS tree after reading it from feed. 2) To rebuild/refresh a solr index in specified intervals. 3) To send an email in specified intervals. 4) To clean up items in database. To achieve this, Sitecore provides a feature called scheduler. Where it will allow us to schedule a task to be executed in the specified intervals. Want to know about scheduler creation and how to configure it?  Let's check below steps : 1) Task Creation 2) Configuring a Task in CMS 3) Scheduling a Task. 1) Creating a Task: using Sitecore.Data.Items; using Sitecore.Diagnostics; using Sitecore.Tasks; namespace Testing.Foundation.Testing.Scheduler {

Overwriting sxa content field in solr document

  Hey ,  there! Welcome to "Sitecore Series" Post is all about sharing the details about "Sitecore SXA search functionality and how to overwrite sxa content field". Sxa search is not returning results even some fields contains the searched text? want to know why it is not searchable and how to fix this?  Trying to generate a search query by passing an extra text like user category/content category and expecting a result with only the matched results where the item in droplist is selected with the same category? but not able to get the expected result? Then this post is for you: Sxa Search Functionality: When Sxa search is configured, if user searched any text in the searchbox it returns the matched result but have you observed this? content that is searchable is actually limits to only few fields content.  By Default the search is limits to single line, multi line and sxa tag fields content.  Sitecore Creates a computed field called "sxacontent_txm" and st

Accessing Items from Sitecore Database in different scenarios

Hey ,  there! Welcome to "Sitecore Series" Post is all about sharing the details about "Accessing items from Databases and about Sitecore.Context.Database in different scenarios". Sitecore.Context.Database.GetItem() returning null even the items exists in the Database? Want to know more details why this is not returning any results or null? You are on right place, check below for details. Let's dig into different scenarios and ways to access database to understand more about this: Different ways to access Databases: 1) Sitecore.Data.Database database = Sitecore.Context.Database; 2) Sitecore.Data.Database database = Sitecore.Configuration.Factory.GetDatabase("master"); 3) Sitecore.Data.Database database = Sitecore.Data.Database.GetDatabase("master"); Last 2 approaches works as expected, but the issue here is we have hardcoded the database values. In the 2&3 approaches, if the piece of code is executed from CD site it will throw an error

How to specify custom richtext menu as default richtext field setting when no source is specified for richtext field in sitecore

Image
  Hey ,  there! Welcome to "Sitecore Series" Post is all about sharing the details about "Richtext field setting in templates and setting custom menu or adding a new menu as default setting to display a different menu in richtext editor" While creating template fields, if the field type is richtext then we have an option to specify the setting item in the source. Based on the setting item, richtext menu will be displayed.  Below are the different settings provided by sitecore: 1) /sitecore/system/Settings/Html Editor Profiles/Rich Text Full 2) /sitecore/system/Settings/Html Editor Profiles/Rich Text IDE 3) /sitecore/system/Settings/Html Editor Profiles/Rich Text Limited 4) /sitecore/system/Settings/Html Editor Profiles/Rich Text Medium 5) /sitecore/system/Settings/Html Editor Profiles/Rich Text Default Based on the setting provided, richtext menu options will vary. If "Rich Text Full" setting is specified, richtext menu contains several options and if &quo

How to disable database switching in Sitecore

Image
Hey ,  there! Welcome to "Sitecore Series" Post is all about sharing the details about database switching in Sitecore and how to disable the database switching for few users or roles. In Sitecore when we login, the default database is set to the master and at the right-bottom corner we have an option to switch to specific data bases like Core database or to Web database. In specific scenarios, we may want to disable the database switching for various security reasons and to provide right access to the right user. Giving extra access for an content author is not recommended, as there may be chances of performing unintended actions by accessing the databases and it's content. So one of the option to provide right access to some content authors is disabling database switch option in Sitecore. In Sitecore, the editor and all the options we are seeing in master database are configured in Core database. Database switch option is also one of them. For disabling database switch o