Introducing the New Sitecore forms on Symposium

Have you ever seen a website without a form?

Exactly, this is because forms are a crucial part of every website. For most interactions forms is the starting point. This is how sites create business value for customers, this is how you generate leads and drive conversions.

That’s why I’m very happy introduce the new Sitecore Forms.  From Sitecore 9 onwards Sitecore forms will not be a module, it’s now part of the core Sitecore Experience Cloud platform. Continue reading “Introducing the New Sitecore forms on Symposium”

Starring in Catching Exceptions

Last User Group Conference I had the

The goal of catching exceptions is simple it’s get to know the people in the Sitecore community and Mark asks four questions:

  1. Where are you from, where did you grow-up?
  2. What got you started in programming?
  3. Where do you work now?
  4. What is it that keeps you interested in Software and Programming?
  5. An unique opportunity to share your exception!

Continue reading “Starring in Catching Exceptions”

Want to help your business user? Create a custom Macro

When talking to business users (people that actually work with Sitecore on a day to day base) I created a small list of minor custom changes that would help the business users with there day to day work.

One of the items on this list is the condition for User Profile fields, by default the input of this field is a manual typed String. Which is a painful process for the business user They are not sure of the fieldname and go to the usermanager to verify the name. And even when they know the fieldname they surely can make a typo. After all even a business user is just human.

Typo and human errors

So after a small thought I started coding. My solution for this problem is simple. Create  a custom Macro with a tree selection and return the item name! Let’s do this!

Create the custom Macro class

Open VS, and create a class called UserProfileFieldMacro that inherits from the IRuleMacro class.

Override the Execute method, in this method we need to define the custom Macro. Please read the code comments for explanation.

The UserProfileFieldMacro class has the following code


public class UserProfileFieldMacro : IRuleMacro
{
    public UserProfileFieldMacro() { }

    public void Execute(XElement element, string name, UrlString parameters, string value)
    {
        Database coreDatabase = Sitecore.Configuration.Factory.GetDatabase("core");

        //Define default path to profile template
        string profilePath = "/sitecore/templates/System/Security/User";

        //Check if custom path is set in Macro parameters
        if (parameters.HasPath)
            profilePath = parameters.Path;

        Item userProfileRootItem = coreDatabase.GetItem(profilePath);

        //The path isn't correct, we want to log this error and send the user to the system administrator
        if (userProfileRootItem == null)
        {
            string error = string.Format("The path ({0}) set in the user profile field condition doesn't exist", profilePath);
            Sitecore.Diagnostics.Log.Error(error, this);
            SheerResponse.ShowError(error + "  Please contact your system administrator", string.Empty);
            return;
        }

        SelectItemOptions options = new SelectItemOptions();

        //Set and hide the root of the tree in the dialog window
        options.Root = userProfileRootItem;
        options.ShowRoot = false;

        //User can only select Templatefields
        options.IncludeTemplatesForSelection = new List { TemplateManager.GetTemplate(TemplateIDs.TemplateField, coreDatabase) };

        //Return the item name to the public property
        options.ResultType = SelectItemOptions.DialogResultType.Name;

        //Set dialog window info
        options.Title = "Select User profile field";
        options.Text = "Select the user profile field to use in this rule.";
        options.Icon = "applications/32x32/media_stop.png";

        //Trigger the dialog window
        SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true);
    }
}

Compile your code.

Create the Items in Sitecore

Login to Sitecore and open the content editor.

Create the macro item

Go to  the /sitecore/system/Settings/Rules/Common/Macros folder and create a new Macro item called UserProfileFieldMacro. Set the Type field to match your custom Macro class and assembly.

image

Create the condition item

Go to the /sitecore/system/Settings/Rules/Common/Conditions/Security folder and duplicate the User Profile Condition Item, name the duplicated itemUser Profile Field Selection Condition.

Now we need to change the Text field so it will use the custom create Macro instead of the default string input. Go to the Text field, I highlighted the part that we are changing

where user profile [FieldName,,,specific] field [operatorid,StringOperator,,compares to] [Value,,,value]

What you see is a four column seperated string. The four columns are representing the following functionatily:

  1. the public property in the condition that will be set.
  2. the macro used to get the user input (blank is string input)
  3. optional parameters to pass to the macro
  4. the text value that appears to the business user when the value is not set

Now change this to use the custom created Macro

where user profile [FieldName,ProfileFieldOperator,,specific] field  [operatorid,StringOperator,,compares to] [Value,,,value]

If you look at the Macro code you will see that if no parameters are passed we use the path to the default user profile. If you have custom user profile you can pass the path as a parameter. For example;

where user profile [FieldName,ProfileFieldOperator,/sitecore/templates/System/Security/Jetstream User,select] field [operatorid,StringOperator,,compares to] [Value,,,value]

Now where all set to test the new condition!

Activate and test the condition

Open the page editor and select a presentation component you want to personalize. Click the personalize button and create a new rule.

Select the for the where user profile select field compares to value  condition and click the red select link. The custom Macro will now fire the dialog window where all the profile fields are available for selection.

image

And the best thing is if the business user selects a Field section the a message will appear. No more humon errors here 🙂

So for my example I configured the following rule for a component called Summer sun.

image

Test the conditional rendering rule

If I visit the website as a logged-in user with the firsts name Pieter the Summer sun component will appear. Otherwise the component will be hidden.

Let’s visit the website as a anonymous visitor.

image

Now after I login with my account (and yes my first name is Pieter) the control will appear.

image

Wrap up!

This solution is specifically created for user profile fields, you could also create a more generic Macro with more custom parameters. For me the most important part is that I showed you how easy it is to create a custom Macro. The next time the business user confront you with their problems, don’t just tell them this is the way Sitecore works. Tell them that you can easily change the behavior of Sitecore within a few hours. And of course share your customizations with us!

Don’t forget to hide the old user profile field condition. Read the article about removing conditions and actions for you business user based on Security.

If you have any questions, comments or own customizations you want to share? Please leave a comment.

Happy coding!

Sitecore Symposium: DMS Datamodel explained slides

For my presentation about the DMS datamodel I created a great amount of slides. I didn’t have time to show all the slides because I only had about 60 minutes to do the talk. I uploaded the complete slidedeck to Slideshare including additional slides about Profiling and Automation.

The complete session has been recorded and will be shared after the Symposium.

Thanks for attending the session and for the great questions. Hope you have enjoyed the session. If you have any feedback or questions about the slides or the session you can leave a comment below.

——————————————————————-
UPDATE
——————————————————————-

The video is available here.

Also read the following reviews and summary of the session:

 

Daily Tip: Use the SitecoreInstaller to create quick Sitecore instances including modules

As Solution Architect a part of my job is doing product demo’s and building Proof Of Concepts. The best way for me is to build stuff based on a clean install of Sitecore with the involved modules installed (like DMS, SES or ECM). Normally you will do this with the default Sitecore installer and manually install the modules you need, but this will take to much of your precious time.

With the  SitecoreInstaller you can install Sitecore with selected modules in one click.

How to use the Sitecore Installer?

There are two things you need to do for the SitecoreInstaller:

  • Create the build library
  • Download and configure the SitecoreInstaller

Create the build library

The build library is where the tool stores files needed for installation such as Sitecore versions, licenses and modules.  And has the following structure:

  • <PathToBuildLibrary>\Licenses
  • <PathToBuildLibrary>\Sitecore
  • <PathToBuildLibrary>\Modules

Read all the information on the projectpage on codeplex:
http://sitecoreinstaller.codeplex.com/wikipage?title=Build library

Download and configure the SitecoreInstaller

  1. Download the Sitecore Installer from Codeplex
    http://sitecoreinstaller.codeplex.com/
  2. Extract the .zip and open the SitecoreInstaller.exe
    Sitecore Installer
  3. First time a configuration wizard will open, insert your SQL credentials
    Sitecore SQL setting
  4. Next step is to select your Build Library folder.

Sitecore Build Library

Run the SitecoreInstaller

By default the SitecoreInstaller runs in a “User friendly” mode, with wizard functionality.

Sitecore Installer example

I’m not that fan of the wizard. But locally you can set the Installer in a more advance mode by selecting View –> Use Developer layout and View –> Show Advanced View.

Sitecore Advance settings

This will give you a great all-in-one interface. Where you can give your install a name, select the CMS version and modules and install with one click.

Sitecore module installer

All credits go to Rasmus Rasmussen for creating and sharing this great tool!

Sitecore Webinar: Pipelines and Processors

This article is based on a Dutch webinar that I presented august 2012 and will refer to the video recording, slides, the How to documentation and used resources.

The video

You can watch the recording on Youtube.

[youtube]http://www.youtube.com/watch?v=EV57kWzUHAc[/youtube]

The slides

The slides of the webinar are in English and are posted on Slideshare

How to

The code used in the webinar is from the Sitecore how to series; How to Track External Links with DMS.

In the webinar I explain how the processor is build, this is explained in step 2 of the How to: Track all External links with a custom Renderfield processor. But the How To also covers the creation of the Link.aspx page and building the report outgoing link report.

Resources

I selected the following resources where you can find more information about pipelines:

Please add a comment if you have more useful links about Sitecore Pipelines (I will update the post).

Contact

If you have any questions about the webinar, code or the how to please leave a comment.

Daily Tip: Great tool the Sitecore Log Analyzer

Did you hear of the Sitecore Log Analyzer? The Sitecore Log Analyzer is a great tool. It does what the name claims; It will help you analyze your log files!

A short list of some great features:

  • Quick analyze of all log files in a directory
  • Date and string filter

Sitecore Log Analyzer Date Filter

  • Tabs for the different categories; Messages, Audit and Health Monitor
  • Filters for log levels; Errors, Warnings and Info’s

Sitecore Log Analyzer Categories Error Warning Info

  • Log entries sorted on number of occurrences

Sitecore Log Analyzer Sorting

  • Timeline overview of the (filtered) log entries

Sitecore Log Analyzer Timeline overview

  • Great statistics 🙂

Sitecore Log Analyzer Statistics

Go ahead and download the Log Analyzer from SDN and analyze you’re log files on a regular basis:
http://sdn.sitecore.net/resources/tools/log%20analyzer/download.aspx

Happy Analyzing,
Pieter