BUG: Sitecore 8.2.7 – TreeList – IncludeItemsForDisplay doesn’t support Guids anymore

A customer of us used a TreeList to display several products. Some products have special access rights, so we have to filter out restricted products and have to use the option “IncludeItemsForDisplay” to show only allowed products. This option was filled by a comma separated list of Guids.

After upgrading to Sitecore 8.2.7 the TreeList doesn’t show the sub items anymore.

Sitecore 8.2.7 TreeList

After contacting Sitecore support the issue was registered as a bug in their bug tracking system:

Issue definition: IncludeItemsForDisplay with ID value doesn’t work in the TreeList DataSource query.
Reference number: 205766

There is a patch available to fix the issue:

To install the patch follow the instructions in the readme file inside the package.

Best regards



Fixing Visual Studio Intellisense in MVC Views

Hi folks,

long time ago since my last post. Hard working all the time to see happy customers with a great experience. 😉

But that post is a short one and of course as a clean developer you don’t want to have intellisense problems in your environment within MVC Views!!!

Sean Holmesby figured it out: http://www.seanholmesby.com/fixing-visual-studio-intellisense-in-sitecore-mvc-views/

But you don’t need all the Configs in the App_Config folder, that’s the core of this post. Always use a less configs in your environment as you can. Sitecore upgrades become harder as more configs you have to upgrade.

So, reduce it to the max, you need:

  • the /Views/web.config
  • the /App_Config/Sitecore.config
  • the /web.config

… in your Visual Studio Project.

When you include the /web.config in your project you will see some more errors because some dll’s are not found. I always reference all this missing dll’s in my solution because I like the “zero warning policy” 😉

Happy configuring



New Sitecore Website released – www.layher.com

My company released another Sitecore website which has also great features, especially with focus on Experience Editor. Every Javascript animations on the homepage are customizable in experience editor.

Also 2 scheduled task to import customer data as user accounts into sitecore and a zip search over 10 thousands zips within a range of your search.

We also have a lot of WFFM forms with custom logic for example count down seminar seats.

Have a closer look at Layher Sitecore Website

Best regards 😉


New Sitecore Website released – www.vega.com

Recently my company has released the biggest sitecore website we’ve ever done! Visit Vega Website to take closer look!

Here are a few statistiks:

  • 18 country specific Websites (trees) in a single sitecore instance
  • 248 configured sites
  • GeoIp Detection and redirection in country specific tree
  • more than 7000 products
  • 5 scheduled tasks to import data
  • Document, product and fulltext search indexes
  • and many many more!

The website has a great performance give it a try! 😉

Regards Dirk

Web Forms for Marketers (WFFM) ‒ Part 3 ‒ Multipart Form, Custom Save Action and a Summary Page with a Custom Validator

Put it all together!

The Registration form consists of three steps. In the first step you can choose a seminar and participants. In the second step you have to fill out address details and at least the third step is a tricky summary page with a custom Summary field which inherits from ListControl, displaying the title of the seminar, all participants and the final price for all the persons.

Step 1

Step 1

Step 2

Step 2

Step 3

Step 3

Now, we know how the form looks like. But there are a lot of things we should take a closer look! 😉

The topmost question is: How to do a multi step form on a single page? There are a few examples in the web where each step has a success page (the next step) Multistep forms using WFFM (webforms for marketeers)

That wasn’t a solution for me, because we have to stay on the current page, there are several seminars on the page in different categories. We can’t expect from the customer to create three success pages for each seminar… that would be hundreds of pages!

Much better!! We create a custom SuccessRedirect-Pipeline and patched it before the Sitecore.Form.Core.Pipelines.FormSubmit.SuccessRedirect-Pipeline.


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
                <processor type="Project.Infrastructure.Pipelines.Form.ProcessSeminarMessage, Project.Infrastructure" patch:before="processor[@method='SendEmail']"/>
                <processor type="Project.Infrastructure.Pipelines.SuccessRedirect, Project.Infrastructure" patch:before="processor[@type='Sitecore.Form.Core.Pipelines.FormSubmit.SuccessRedirect, Sitecore.Forms.Core']"/>



public class SuccessRedirect : ClientPipelineArgs
    private const string RegistrationFormularAnchor = "#SeminarRegistrationContainer";

    public void Process(SubmitSuccessArgs args)
        Assert.IsNotNull(args, "args");
        if (args.Form == null)
        if (args.Form.ID != ItemIds.Forms.SeminarRegistrationStep1 && args.Form.ID != ItemIds.Forms.SeminarRegistrationStep2)
        var url = GetRedirectUrlForRegistrationFormular(args);
        if (string.IsNullOrEmpty(url))
        WebUtil.Redirect(url, true);

    private string GetRedirectUrlForRegistrationFormular(SubmitSuccessArgs args)
        var url = LinkManager.GetItemUrl(Context.Item);


        var parameter = new[] {"step", "2"};
        if (args.Form.ID == ItemIds.Forms.SeminarRegistrationStep1)
            return WebUtil.AddQueryString(url, parameter) + RegistrationFormularAnchor;
        if (args.Form.ID == ItemIds.Forms.SeminarRegistrationStep2)
            parameter = new[] {"step", "3"};
            return WebUtil.AddQueryString(url, parameter) + RegistrationFormularAnchor;
        return url;

The code is quite simple! All three Forms are added in standard values as a rendering. I check the form-id which is submitted and add a parameter to the url like ?step=2. On the Seminar Form  Page I simply have to check the parameter in the url and display the appropriate form.

Such easy is multistep form redirection!!! 😀

Summary Field

All fields which are neccessary for the summary field and the final email-message are tagged:


In this case we are able to get all Submits (form-steps) from the current Analytics Session and we can use them to show a summary with informations submitted in Step 1. I displayed the chosen Seminar Title included the Seminar Appointment (date and location) and all applicants, also submitted in form step 1.

Code looks like this:

public class SeminarFormSummary : ListControl
    private const string baseCssClassName = "scfSummaryListBorder";
    private AppointmentModel _appointment;
    private SeminarModel _seminar;
    private IField _seminarRadioListField;
    private string _validationValue;
    protected RadioButtonList bulletedList = new RadioButtonList();

    public SeminarFormSummary(HtmlTextWriterTag tag) : base(tag)
        CssClass = baseCssClassName;

    public SeminarFormSummary() : this(HtmlTextWriterTag.Div)

    public IFormService FormService { get; set; }

    public ISeminarSummaryControlFactory SeminarSummaryControlFactory { get; set; }

    public override string ID
        get { return base.ID; }
            title.ID = value + "text";
            bulletedList.ID = value + "scope";
            base.ID = value;

    public override ControlResult Result
           return new ControlResult(ControlName,  _validationValue ?? string.Empty,  string.Empty);

    protected override System.Web.UI.WebControls.ListControl InnerListControl
        get { return bulletedList; }

    [VisualProperty("Css Class:", 600)]
    [VisualFieldType(typeof (CssClassField))]
    public new string CssClass
        get { return base.CssClass; }
        set { base.CssClass = value; }

    public string Value
            var stringBuilder = new StringBuilder();
            foreach (var listItem in InnerListControl.Items.Cast<ListItem>().Where(listItem => listItem.Selected))
                stringBuilder.AppendFormat("<item>{0}</item>", listItem.Value);
            return stringBuilder.ToString();

    private void Inject()
        var bs = new Bootstrapper();

    protected override void OnInit(EventArgs e)
        bulletedList.CssClass = "scfSummaryList";
        help.CssClass = "scfSummaryListUsefulInfo";
        title.CssClass = "scfSummaryListLabel";
        title.Text = GetTitle();
        generalPanel.CssClass = "scfSummaryListGeneralPanel";
        Controls.AddAt(0, generalPanel);
        Controls.AddAt(0, title);
        generalPanel.Controls.AddAt(0, help);
        generalPanel.Controls.AddAt(0, bulletedList);

    private string GetTitle()
        var seminarTitle = string.Empty;
        if (_seminar != null)
            seminarTitle += string.Format("<h2>{0}</h2>", _seminar.Title);
        if (_appointment != null)
            seminarTitle += string.Format("<h4>{0}, {1}</h4>",
        seminarTitle += string.Format("<h6>{0}</h6>", Translator.Translate("Teilnehmer"));
        return seminarTitle;

    protected override void OnPreRender(EventArgs e)
        title.AssociatedControlID = null;

    protected override void InitItems(ListItemCollection collection)
        var formStep1 = FormService.GetSubmit(ItemIds.Forms.SeminarRegistrationStep1, AnalyticsTracker.SessionId);
        if (formStep1 != null)
            _seminarRadioListField = FormService.GetField(formStep1, new Guid(FieldIds.Forms.SeminarRegistration.Seminars));
            if (_seminarRadioListField != null && !string.IsNullOrEmpty(_seminarRadioListField.Value))

        if (_seminar == null)

        var participantsCollection = SeminarSummaryControlFactory.CreateParticipantsListItemCollection();

    private void GetAppointmentAndSeminar(string value)
        var context = new SitecoreContext();
        _appointment = context.GetItem<AppointmentModel>(new Guid(value));
        _seminar = (_appointment != null) ? context.GetItem<SeminarModel>(_appointment.ParentItem.Id) : null;
        _validationValue = value;


Web Forms for Marketers (WFFM) ‒ Part 2 ‒ Show/Hide Fields with Rules

Well, sometimes customers have very special requirements. In this case the customer wants to show or hide applicants for a seminar dynamically.

Have a look how this should work:


It is not really possible to add fields dynamically to WFFM, so we decided to add 4 applicant-fields (Salutation, Firstname, Surname) in WFFM.


The JavaScript for the Add-Applicants-Button and the Remove-Buttons looks like this:

var rightSection = $('div.section-right');
 $(rightSection).on('click', '.scfAddAttendantButton', function() {
     var hiddenFields = $(this).parent().find('div.thirdAvailableWidth[style="display: none;"]');
     $(hiddenFields).each(function(index, element) {
         if (index == 2) {
              return false;
         return true;
     if (hiddenFields.length == 3) {
         $('div.section-right .scfAddAttendantButton').hide();

 $('.seminar-registration-content div[class*="name.Nachname"] .remove-button').click(function() {
     var hiddenFields = $(this).parent().parent().find('div.thirdAvailableWidth[style="display: none;"]');
     if (hiddenFields.length == 0) {
         $('div.section-right .scfAddAttendantButton').show();


Simple isn’t it? 🙂

To show / hide fields when text is entered in any field we use WFFM-Rules:

Rules to show or hide fields when text is entered in a previous field

Rules to show or hide fields when text is entered in a previous field




A short explanation to the field values: ^$ is a regular exprission for string.Empty, ^(?!\s*$).+ is a regular expression for !string.Empty.

The WFFM rules are a mighty way to interact with the form! It is also possible to restore values from the Analytics Cookie:

Rules to restore values from the analytics cookie





Next part is a custom Save-Action. Stay tuned.

Regards Dirk

Web Forms for Marketers (WFFM) ‒ Part 1 ‒ Custom Radio List Field ‒ Data source and Appearance

One of the most powerful Modules in Sitecore is Web Forms for Marketers.
The most powerful forms engine I ever saw!

Installing is quite easy, configuring has some tripping hazard (feel free to contact me, to solve your problems setting up WFFM), but if everything runs as expected you will love it!

I have never, never, never ever build such complex forms without coding!

But stop, sometimes advertising agencies have great designs and great ideas which looks beautiful…. in Photoshop

As a developer, you can despair sometimes on templates you get as a requirement, because for sure the customer likes the well designed templates for his page. 🙂

And sometimes, also WFFM has its limits realizing such templates from Page Editor.

So far so good, here is a scenario, where Design meets coding… where Photoshop meets me :D, because I’m a coding designer and I love to realize such challenges in Sitecore 😉

Okay, enough talking, here we go:

Scenario: The customer has Seminars with any number of appointments, the seminars can have a start date, an end date, a location, a information text and, that’s important later, a fix number of seats.

Structure in Sitecore looks like this:


Visitors can fill out a form to register to a seminar, in fact that data should be saved to Database, one Mail should be send to the registrant, one Mail should be send to the customer and a custom Save Action should count down the available seats, I do that in WFFM!

Here is the template how the form should look like:


Well, uuuuuhm… nice one … everything is fine and can build by the form designer, except the appointment Radio List above.

There are 2 difficulties to take care about.

  1. WFFM can select items for a Radio List from the tree and by queries. But I want to display the children of the current context item. It took a long time for me to realize that the form doesn’t have the context item, please correct me if I ‘m wrong! Queries like: child::*[@@templateid='<Some Guid>’] works fine in XPath Builder if the path is set to a seminar item… But, start path for queries is /sitecore, you will get no result or you can use descendant::*[@@templateid='<Some Guid>’] and you will get all appointments… I was not able to handle that with queries 😦
  2. In case you have a result in your query… you are able to set a value and a text for the List Item (both from any fields of the item). Let’s look again at the picture above. Title comes from the Seminar itself, the other 3 lines are information from the appointment…. pah! Not possible to display that with functionality of the form designer …

It is possible to display that, even in the form designer. What we need is a new Radio List Field Type and of course what we do next is very specific, and we only need this to display the Seminars Radio List, so we call our new Control SeminarsRadioList, which inherits from Sitecore.Form.Web.UI.Controls.ListControl.

I don’t want to get in deep so I’ll show you just the method to override, and the methods I need to display the text as required in combination with Glass.Mapper. If you are not conform with Glass.Mapper do the following:

  • override InitItems()-Method
  • in InitItems get the context item (the seminar)
  • Create a new method to iterate through the children (appointments) where the available seats greater 0 (in part 3 we count down the seats for each registration as a custom save action!)
  • return a new ListItemCollection, each List Item has a Text and a Value, format the Text as required (Method is self explainable), Value is the Id of the appointment

That’s it!

protected override void InitItems(ListItemCollection collection)
			var context = new SitecoreContext();
			var seminar = context.GetCurrentItem&amp;lt;SeminarModel&amp;gt;();
			var appointmentsCollection = CreateAppointmentsListItemCollection(seminar);


		private ListItemCollection CreateAppointmentsListItemCollection(SeminarModel seminar)
			var appointments = seminar.Children.OfType&amp;lt;AppointmentModel&amp;gt;().Where(x =&amp;gt; x.AvailableSeats &amp;gt; 0);

			var collection = new ListItemCollection();
			var index = 0;
			foreach (var appointment in appointments)
				collection.Add(new ListItem(GetAppointmentText(seminar.Title, appointment), appointment.Id.ToString())
					Selected = index == 0
			return collection;

		private string GetAppointmentText(string seminarTitle, AppointmentModel appointment)
			var text = string.Format("{0}<br/>{1}<br/>{2}<br/>{3}", seminarTitle, appointment.DateTimeFrom, appointment.Location, appointment.InfoText);
			return text;

The result looks like this:


Great, isn’t it? Next step I tried is to check if WFFM recognize my little hook. 🙂

I set of course a “Send Email Message” Save Action to have a look how the fields are rendered in the mail.

But after submit there was only a Guid in the mail of course the Id of the appointment which was set as value of the List Item…

During installation and configuring WFFM I read about a custom pipeline:
How to Configure an Email Message Using the ProcessMessage Pipeline (Page 41 in WFFM Reference)

Following that example, you will be able to get the Seminars Radio List field:

var seminarsField = args.Fields.FirstOrDefault(x =&gt; x.FieldID == FieldIds.Forms.SeminarRegistration.Seminars); //constant Guid to the seminars field ID
if (seminarsField != null)
	args.Mail.Insert(0, seminarsField.Parameters);

My first thought was: Cool I have the value (Guid) of the appointment, I could take the Guid, fetch the item again and format the mail. But it was easier as expected! In seminarsField.Parameters is exactly the text we formatted in the picture above!!!

The Email looks like this:


All information are present. 🙂

In the next step to finish the form I challenge the other difficulty… dynamically show/hide fields WFFM… 😉

Stay tuned!

Best regards Dirk

MVP Nomination

Wohooooo, awesome things happened to me! On November 27th 2014, I received an email from Sitecore Headquarter. They nominated me as MVP (Most Valued Professional).

I hope I doesn’t end up like Leonardo DiCaprio… always nominated for an Oscar, but never won. 😀

My hope that it’s folding this year, is rather low, because I don’t have much Blog entries, Stackoverflow comments or even Sitecore Forum threads and comments, but nevertheless at least one great Sitecore Translation module on Sitecore Marketplace!

We have 3 huge Sitecore projects of global playing customers in the company I work and my focus is on: Work! Work! Work! Do some new best practices! Work! Work! Dive into the deeps of Sitecore! Work! Family! Work! 😀

No fun! Even in my free time (mostly at night) I work on a Sitecore project which will be released in March and just believe me, this project is full of Sitecore best practices like Dynamic Key Placeholder (for sure), a great structure, forms created with Web forms for Marketers (read my next blog about WFFM), Glass.Mapper with Interface based Models and inheritance templates, Customer data imports through scheduled tasks and many more!

Uhm, lots of stuff to write hundreds of blogs! The day should have 48 hours to find the time to wrote blogs. 😉

Stay excited 😉

Best regards Dirk

SeitenKern Translator Module

Well, let me introduce my first Sitecore Module!

SeitenKern Translator is a all-round translator for your website and an important module for all .NET Sitecore developers.

The Translator Module is available on Sitecore Marketplace, you can also download the source code from GitHub, for free!!

Nearly all websites are multilingual and managing translations is always a hard step in development progress.

This module helps you to manage your translations with ease! It builds on the dictionary domain concept (thanks to almighty John West for the explanation), introduced in version 6.6 of the Sitecore ASP.NET Web Content Management System (CMS).

It’s very easy to use! Within 5 Minutes you are ready to take the full advantages of the module, and managing translations is blown out of your mind 😉

The module requires a small set of templates:

  • dictionary folder (for structure only)
  • dictionary domain (item-id with this template should take place in your site config)
  • dictionary folder (the folder for the dictionary index)
  • dictionary entry (at least the entry template)

Keep in mind: The dictionary domain has a fallback domain! If a key is not found in the current dictionary, the translator searches for the key in the fallback domain and returns the translation item if key is found. Else, the translator adds the key to the current dictionary.

If a key was loaded from the fallback domain and you set “AddToAllDictionaries” sometime later, the translator is smart enough to recognize this! It adds the translation to the current dictionary and to all other configured dictionaries where not an item with this key exists!

Give it a try and also a recommendation if you like it!

Best regards Dirk