Sitecore SPEAK DatePicker issue with date selection

In this post I describe how to fix/workaround the issue with DatePicker component in Sitecore SPEAK 2.

Usually, DatePicker works just fine but at some point we noticed that something wrong is happening with date selection …

I identified two issues:

  • when we click the date in calendar it selects today rather than selected date
  • when we click the date in calendar it shows that we selected the date but value is set for today’s date not one that is shown

It might be related to the fact that I had to DatePicker components on a single page. Also, it might be related to the custom format of data that we use in the DatePicker – dd/MM/yyyy.

After some checks I decided to overwrite the vanilla DatePicker javascript with changed one.

Javascript file is in the path:

/sitecore/shell/client/Business Component Library/version 2/Layouts/Renderings/Common/DatePickers/DatePicker.js

I fixed it by adding ‘global’ variable to store set value: “definedDate”

Then I use that variable in two places.

First one is formatDate function that is called usually after selection

Second one is inside getISODate where we use it to calculate correct date

That change solves the incorrect behavior of the form.

Sitecore’s Personalization under the hood

About two months ago I had a pleasure to conduct webinar about personalization but this time I focused on something that people usually skip.

I did not describe how to setup the personalization rules but I tried to explain

  • what does it mean to apply a good personalization
  • why it is beneficial to apply personalization (for customers and companies)
  • how it works under the hood (algorithms and calucations process)

If you are interested in details you can watch it here (click image – you must to enter your email in the form to see the video):

You can also check details of presentation on slideshare:

I hope you like it – if you want to discuss it, please use comments section or reach me via social media.

How to get the latest logs from Azure with Kudu

Before I will tell you how I want to describe to you why someone may need to use Kudu to get logs from Azure.

Of course, the best way to work with Sitecore logs (when it is installed as PaaS) is the Application Insights tool. But when it has to be disabled because of many different reasons we are forced to use good old files with logs.

An issue with log files is the fact that when a file is in use we cannot just download it from the server with FTP client because it is locked by IIS process. To access the latest data we must use Kudu tool – but it is not the most efficient way to find and open log file – especially when you have thousands of log files and Kudu does not allow us to sort the files by date to get that one you need.

How to find in Kudu lately updated files?

Let’s start with the opening of PowerShell tool in Kudu

Then by clicking or with command enter the directory with logs files.

cd "D:\home\site\wwwroot\App_Data\logs"

As a result, you will see the list of files with pagination – it means that in case of having thousands of files – to find the file is a nightmare. Thanks to PowerShell console, we can find the name of a file very quickly.

Run the following command to get files modified during last hour:

Get-ChildItem | Where { $_.LastWriteTime -gt (Get-Date).AddHours(-1) }

(you can run two commands at once, just use a semicolon between two of them)

As a result, you will see in a PS console a list of files names:

Now, to get the file you have to use Kudu’s URL (copy it from the browser) – get only a domain, then add the following path to it, with name of your file at the end:

/api/vfs/site/wwwroot/App_Data/logs/nameOfYourFile

In total you should receive something like this:

https://domainWithSCMinIT/api/vfs/site/wwwroot/App_Data/logs/nameOfYourFile.txt

Open it in the browser to get the latest data from the currently used log file.

How to link Unicorn’s directories from solution and wwwroot?

If you use Unicorn to serialize your Sitecore’s items you probably at least once had to decide how to share a directory where serialized items are, between repository (solution) and your local Sitecore instance.

The most common solution is to store serialized items in the solution and just set the correct path to this directory in config files to let Sitecore instance read those.

Unfortunately, with this configuration, we need to adjust the path where items are, to every environment – who does like to remember about this?

If you do not want to do that, you can use “junction” which is just a different type of link. Thanks to the junction we can link the whole directory not a single file.

To create junction link you need to run following command from CMD:

mklink /J C:\inetpub\wwwroot\XXX\Data\Unicorn C:\Projects\XXX\App_Data\Unicorn

Where the first path is the place where your junction link will be created (wwwroot) and a second path is a place where your serialized items are (repository). That is it! So simple!

After the creation of a junction link, you will be able to use the same path on all environments!