Adding, Removing and Sorting Child Items in Sitecore Experience Editor

If you have a Sitecore component that picks up and renders its child items, such as a Hero Slider or a Navigation component, you can enable Inserting, Deleting and Sorting child items in the Experience Editor simply by adding some Experience Editor Buttons on the rendering:

Wordpress

Here is how it looks to insert or sort child items in the Experience Editor using the Edit Frame Buttons:

add

sort

Advertisements

My Experience with the Coveo for Sitecore Developer Certification Exam

I have recently passed the Coveo for Sitecore 4.0 Cloud Certified Developer Exam and I’d like to share some of my experience here. It’s a three-hour exam but you probably won’t need that much time. It took me around two hours. You can choose to pause the exam and finish it later.

There are 90 multiple choice questions in total, and the passing mark is 70%. According to the exam guide, you can and are recommended to:

  • Install and experiment with the latest release of Coveo for Sitecore 4.0 with Coveo Cloud before taking the exam
  • Refer to the Coveo for Sitecore 4.0 developer training PDFs
  • Refer to the Coveor online documentation
  • Refer to a working instance of Sitecore with Coveo for Sitecore 4.0 already integrated

That means the exam is ‘open-book’, at least for now. That does Not mean it is an easy test. A good number of the answers don’t live directly in the PDFs and you may not even know where to find them online if you aren’t familiar with Coveo or aren’t well prepared. Here is what I did and would suggest you do in order to get a good score in the exam:

  • Pay attention during the training session and get at least the bulk of the learning in
  • Read patiently through the 400-page training PDF before the exam
  • Have the working instance of Sitecore with Coveo integrated on the side while reading the PDF so you can refer to it/experiment with it
  • Check out the related links in the PDF and at least skim through their content
  • Check the online documentation whenever you come across concepts you don’t quite understand

I attended a live training session provided by Coveo; you can also attend a training course found here. After taking the training, you will receive a unique free exam link via email, which never expires. You do have only one attempt per link and a retake costs US$500. The trial edition Coveo you used during the training does expire but you can probably get an extension by contacting your Coveo account manager or Coveo support.

Be sure to take a look at this site, where you can find important information on the exam including the Topics Covered:

“The certification exam covers many aspects of the Coveo for Sitecore solution including installation, upgrade, features, pricing, architecture, modules, scaling, configuration, fields, search queries, debugging, Coveo Cloud Platform, Coveo Search API, external content, Underscore.js, Coveo JavaScript Search Framework, UI components, resources, and more.”

Thanks, and good luck! 🙂

PFk2GlAV_400x400

ERROR SCRIPTDOM NEEDED FOR SQL PROVIDER

When I was installing Sitecore 9 I got an error ERROR_SCRIPTDOM_NEEDED_FOR_SQL_PROVIDER. This error could appear in other scenarios that involve SQL as well.

I was sure I have all SQL provider dependencies including T-SQL ScriptDom installed. The issue was resolved when I used gacutil on the scriptDom dll with the command below in the command prompt window:

“<C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil>” /i “<C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\Microsoft.SqlServer.TransactSql.ScriptDom.dll>”

Your gacutil and scriptDom dll may be in a different folder as in mine. Before using the command please check and correct the paths if they are different.

 

Sitecore: Could not load file or assembly ‘Oracle.DataAccess, Version=2.112.1.0’ or one of its dependencies. The system cannot find the file specified.

I recently came across this error on my Sitecore site after I installed and uninstalled Sitecore.Ship:

Could not load file or assembly 'Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I’d like to share here how I fixed this error and my debugging process. The first thing I did was to enable assembly binding logging to get more information. To do this: type in Regedit in your Start search bar and open Registry Editor. On the left panel navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion, right click on the empty space on the right side and click New > DWORD(32-bit) Value. Make the Name “EnableLog” and right click on it, click “Modify…” and change Value data from 0 to 1.

regedit

After modifying this setting, go back to your Sitecore website and hit refresh (restart your computer if the error message does not change). Now you can see the binding log:

=== Pre-bind state information ===
LOG: DisplayName = Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
 (Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/dotcom3/Website/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\dotcom3\Website\bin
Calling assembly : Sitecore.Oracle, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\dotcom3\Website\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

Stack Trace:
[FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.]
   System.RuntimeTypeHandle.GetDeclaringType(RuntimeType type) +0
   System.RuntimeTypeCache.GetEnclosingType() +27
   Nancy.TinyIoc.TinyIoCContainer.<AutoRegisterInternal>b__13(Type type) +80
   System.Linq.WhereListIterator`1.MoveNext() +79
   Nancy.TinyIoc.TinyIoCContainer.AutoRegisterInternal(IEnumerable`1 assemblies, Boolean ignoreDuplicateImplementations, Func`2 registrationPredicate) +652
   Nancy.DefaultNancyBootstrapper.AutoRegister(TinyIoCContainer container, IEnumerable`1 ignoredAssemblies) +270
   Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise() +191
   Nancy.Hosting.Aspnet.NancyHttpRequestHandler..cctor() +44
[TypeInitializationException: The type initializer for 'Nancy.Hosting.Aspnet.NancyHttpRequestHandler' threw an exception.]
   Nancy.Hosting.Aspnet.NancyHttpRequestHandler..ctor() +0

The first block of red text tells us the calling assembly is Sitecore.Oracle. If you open that dll using a decompiler such as dotPeek you can see under References near Oracle.DataAccess there is a question mark, and Location is empty in Properties.

dotPeekOracle4

From the second block of red text you can see that an exception is thrown by Nancy, a lightweight .Net framework for building HTTP based services. Sitecore.Ship has added a dependency Nancy.Hosting.AspNet. You’d think with the uninstallation of Sitecore.Ship this dependency should go away, but it doesn’t. This configuration is done in your Sitecore wwwroot/Website/Web.config file and it’s not removed upon uninstallation. Before installing Sitecore.Ship everything worked fine because although the Oracle.DataAccess assembly doesn’t exist, it was not being called.

So, find these lines in your Web.config file and remove them:

<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" /><remove name="Sitecore.Ship" /><add name="Sitecore.Ship" verb="*" type="Sitecore.Ship.AspNet.SitecoreShipHttpHandler, Sitecore.Ship.AspNet" path="/services/*" />
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />    <add verb="*" type="Sitecore.Ship.AspNet.SitecoreShipHttpHandler, Sitecore.Ship.AspNet" path="/services/*" />
</httpHandlers>

Now the error message should go away. Remember to delete the EnableLog registry value in Registry Editor.

Feel free to let me know your thoughts.

Sitecore PowerShell – Enable Item Level Language Fallback

The use case for this blog is to enable item-level fallback on all items based on any user-defined template (or based on any template located in a given folder).

Here are three steps you need to follow in order to set up the language fallback functionality in Sitecore:

  1. Enable site-level fallback in \Website\App_Config\Include\Sitecore.LanguageFallback.config.
  2. Specify the Fallback Language for the language items located in sitecore/system/Languages.
  3. Either enable item-level fallback or field-level fallback per your need.

To enable fallback for all items of a given template, just set it on the template’s __Standard Values.

fallback

However, when there are too many templates to deal with, this task can become very tedious, so we are going to automate this process and perform a batch update using Sitecore Powershell Extensions.

Here is my script:

Write-Host "Creating Standard Values items for:" -ForegroundColor green
$Items = Get-ChildItem master: -ID "{GUID of the templates folder}" -Recurse | Where-Object {$_.TemplateName -eq 'Template'-and `
                !$_.Children["__Standard Values"] }

foreach($Item in $Items)
{
    Write-Host $Item.Paths.Path
    $standardvalues = New-Item -Parent $Item -Name "__Standard Values" -type $Item.ID
    $Item.Editing.BeginEdit()
    $Item["__Standard values"] = $standardvalues.ID
    $Item.Editing.EndEdit()
}
Write-Host "Total number of items modified: " $Items.Count

Write-Host "Enabling Item Level Fallback for:" -ForegroundColor green
$Items = Get-ChildItem master: -ID "{ GUID of the templates folder }" -Recurse | Where-Object {$_.Name -eq '__Standard Values'-and `
                $_.'__Enable item fallback' -eq $false }
foreach($Item in $Items)
{
    $Item.'__Enable item fallback' = $true
    $Item.Paths.Path
}
Write-Host "Total number of items modified: " $Items.Count

The first half of the script finds all templates within the given folder (such as a “User Defined Templates” folder), and creates a __Standard Values item for the templates that don’t already have one. The second half of the script goes through all the __Standard Values items that don’t have Enable Item Fallback checked and set them to true.

The paths of all modified items are printed to the console:

Creating Standard Values items for:
 /sitecore/templates/User Defined/Public/Carousels/FeaturedItemsCarousel
 True
 /sitecore/templates/User Defined/Public/Carousels/RecognitionCarousel
 True
 /sitecore/templates/User Defined/Public/Carousels/TimelineCarousel
 True
  …
Total number of items modified:  39


Enabling Item Level Fallback for:
 /sitecore/templates/User Defined/Public/Careers/Statement Block/__Standard Values
 /sitecore/templates/User Defined/Public/Careers/Header Section/__Standard Values
 /sitecore/templates/User Defined/Public/Careers/Landing Hero Section/__Standard Values
  …
Total number of items modified:  227

 

Now you efficiently have all items based on the templates in that folder enabled for fallback. Please feel free to let me know your thoughts and suggestions. Thanks!

My Experience with the new Sitecore® Professional Developer Certification Exam (MVC)

I have just passed the new Sitecore® Professional Developer Certification exam today and I’d like to share some of my experience here. It’s a two-hour exam but you are likely to finish it in one hour or less. 70 multiple choice questions in total, no notes allowed. The exam questions are not very hard but they are very comprehensive. They cover all the topics (shown below) listed on the Exam Study Guide page, and the accompanied percentages are quite accurate. The Sample Questions on that Study Guide page were a big help on the exam, and so were the review questions at the end of each module in the training material.

Competencies % of Questions
API 6 %
Architecture 2 %
Creating and Editing Items 9 %
Development Environment 6 %
Fields and Field Types 9 %
Installation 2 %
Marketing 10 %
Media 2 %
Module Packages 2 %
Multi-Language 3 %
Publishing 6 %
Search 10 %
Security 6 %
Sitecore Documentation and Support 2 %
Templates 11 %
Versioning 2 %
Workflows 3 %
xManagement 9 %
TOTAL 100%

It’s been about four months since I first got on Sitecore. I was staffed on a Sitecore project after the first month of learning and now the project has just been completed. If you could fully focus on just preparing for the exam, one month of time should be enough, assuming you have some prerequisite knowledge in ASP.NET and MVC. Here are some of my personal experience and recommendations:

– Watch all the Sitecore® Experience Solution Developer eLearning training videos. This is the most helpful resource for the exam. Take notes and screenshots throughout the course because:

  1. The course expires after a few months and you won’t be able to come back to it.
  2. Reviewing the notes and screenshots when it gets close to the exam day proved to be very helpful to me. Many exam questions come directly from details that I have taken down in my notes.

– Complete all the labs in the Workbook PDFs that come with the training. The labs are very hands-on and well designed. I did the labs after I went through all the training videos, because:

  1. I couldn’t help but first cover all the aspects Sitecore has to offer; doing the corresponding lab right after each module slows me down.
  2. Many, many topics are covered in the training (and surely in the exam), and I tend to forget some knowledge that I’ve learned as I go along with the training. Starting the labs after completing all the training videos gives me another chance to refresh and enhance my memory. There were some exam questions that I was able to answer because I did the labs, coded in Visual Studio and configured in Sitecore.

– (Optional) Get on a real-life Sitecore project. I have heard talk that the old Web Form training was not super helpful in terms of practical usage, but that’s not the case with the new training. I got up to speed with the project development quite fast because I was prepared from the training. More than a few times I used my notes and the book mentioned below as reference to resolve the problems I had at hand. On the other hand, the project experience familiarized me with Sitecore development and thus I could fly though the labs later without much need to debug.

– (Optional) Read the Professional Sitecore 8 Development book by Phil Wicklund and Jason Wilkerson. This book should be read after you complete the training material (said from someone who didn’t – I read the book first), or else you might often get confused reading it. This book will help you more in your development experience than the certification exam; it includes some discussion and projects on topics such as Helix, Inversion of Control, Design Patterns, the Sitecore PowerShell extension etc. If all you have is the book and you don’t have access to the $1500 training, this free course, Sitecore® Developer Foundations, can get you started with some basic concepts.

I’m very happy to share my experience with the hope that it can help prepare you for the exam. I encourage you to write any feedback about your experience or questions about the exam. Good luck!