Automate friendly field descriptions


As you may well know when creating and naming fields in Sitecore we also need to create a friendly title for the content editors. By default Sitecore doesn’t make this as easy as it could be and therefore there are a number of naming conventions and solutions for this simple but fundamental issue.

I have always taken the approach of camel casing my field names. It makes sense from a coding perspective. It is a good practice as most developers understand this convention and its benefits. Also when integrating with ORMs such as glass a camel case field name will map directly to the property name of the class without additional mapping attributes.

The obvious issue with using camel case field names is that the default value the content editors see is the field name. Camel case is great for developers but not as good for content editors, so we need to manually write a friendly display description for the editors. This leads to double entry of field name and field description and then keeping this consistent.


Auto generate a friendly field description based on the field name by splitting the camel case and adding spaces. For additional information sometimes required we use the help text option.


Field Name:


Generated Field Description:


Addition information:



Tap into the item on saving event and add some basic code to auto generate a display title based on the field name.

namespace Aceik.Framework.SC.Extensions.Events
    using System;
    using System.Text.RegularExpressions;

    using Sitecore.Data;
    using Sitecore.Data.Items;
    using Sitecore.Events;

    /// <summary>The item on saving events.</summary>
    public class ItemOnSavingEvents
        /// <summary>The field title name.</summary>
        private const string FieldNameTitle = "Title";

        /// <summary>The field template id.</summary>
        private readonly ID fieldTemplateId = new ID("{455A3E98-A627-4B40-8035-E683A0331AC7}");

        /// <summary>The on item save.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The args.</param>
        public void OnItemSaving(object sender, EventArgs args)
            var contextItem = Event.ExtractParameter(args, 0) as Item;

            if (contextItem == null)

            if (contextItem.TemplateID == this.fieldTemplateId && contextItem.Fields[FieldNameTitle] != null)
                contextItem.Fields[FieldNameTitle].SetValue(SplitCamelCase(contextItem.Name), false);

        /// <summary>The split camel case.</summary>
        /// <param name="input">The input.</param>
        /// <returns>The <see cref="string"/>.</returns>
        private static string SplitCamelCase(string input)
            return Regex.Replace(input, "([A-Z])", " $1", RegexOptions.Compiled).Trim();

Patch in the following config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="">
  <events timingLevel="custom">
      <event name="item:saving">
        <handler patch:instead="*[@type='Sitecore.Tasks.ItemEventHandler, Sitecore.Kernel']" type="Aceik.Framework.SC.Extensions.Events.ItemOnSavingEvents, Aceik.Framework.SC.Extensions" method="OnItemSaving"/>

As the description is being auto generated it restricts your ability to add a custom description, however you can add additional information to the display title by adding help text. This blog explains it well:

Sitecore 7.5 highlights

MongoMemeHi, welcome to my Sitecore 7.5 highlights.

This blog post is intended for those of you who would like a high level overview of Sitecore 7.5, need a reminder or have not had the time to investigate this release. At the bottom of this post is a list of useful resources related to Sitecore 7.5.


  1. Sitecore 7.5 = Sitecore 7.2 + xDB.
  2. xDB (Experience Database) is the new name for the Analytics database.
  3. New Contact entity allows tracking an individual across devices, visits and cookies.
    • Requires some sort of mechanism of identifying the user( login, form submission, checkout etc)
  4. New scalable analytics data architecture
    • Session DB (private and shared) (inProc, Sql or Mongo)
    • Collection DB i.e. xDB (Mongo)
    • Reporting DB (SQL)
  5. Experience profile (xFile) i.e the contact
  6. xDB Cloud
    • Sitecores cloud hosting offering for xDB
    • Pricing based on numbers of stored contacts.
  7. Mongo DB
    • Data stored in documents not tables
    • Collections of documents rather than tables with rows.
    • Scales horizontally not vertically
    • Data stored in BSON binary Json
  8. Upgrade key points
    • Analytics API has many small changes
    • Migration of data from Analytics DB to xDB i.e. SQL to Mongo
    • Review of hosting structure to suit xDB.
  9. Other name changes:
    • Customer Engagement Platform = Sitecore Experience Platform (Sitecore XP)
    • Digital Marketing System (DMS) = Experience Marketing
    • Email Campaign Manger = Email Experience Manager
    • Engagement Analytics = Experience Analytics
    • Adaptive Print Studio = Print Experience Manger
    • Engagement Automation = Experience Automation

Sitecore 7.5 Resources

Sitecore membership guide

join1Below is a core list of commonly used authentication and authorization methods to act like a quick reference guide for people building membership based Sitecore solutions.

This reference is intended to get you on the right track immediately from the one source.

If anyone has anything they would like me to add to the list please comment below and I’ll update it accordingly.


These are the required references for the following examples:

using System;
using System.Collections.Generic;
using System.Linq;
using Sitecore;
using Sitecore.Security;
using Sitecore.Security.Accounts;
using System.Web.Security;
using Sitecore.Security.Authentication;

Retrieving Users

//Get all users regardless of domain, Sitecore, extranet, custom etc:
public IEnumerable<User> GetUsers()
return UserManager.GetUsers();

//Get all users for a particular domain, in most situations this will be of more use then getting all users:
public IEnumerable<User> GetUsers(string domainName)
return UserManager.GetUsers().Where(user => user.Domain != null && user.Domain.Name == domainName);

//Get a user from a custom property. This can be useful to find a user by some unique value.
public User GetUserFromCustomField(string fieldName, string fieldValue)
return UserManager.GetUsers().FirstOrDefault(user => user.Profile.GetCustomProperty(fieldName) == fieldValue);

//Get a collection of users from a custom property. An example might be to get all male users.
public IEnumerable<User> GetUsersFromCustomField(string fieldName, string fieldValue)
return UserManager.GetUsers().Where(user => user.Profile.GetCustomProperty(fieldName) == fieldValue);

//Again with queries like this it is most likely that filtering by domain name will be more useful then searching all users.
public User GetUserFromCustomField(string fieldName, string fieldValue, string domainName)
return UserManager.GetUsers().FirstOrDefault(user => user.Profile.GetCustomProperty(fieldName) == fieldValue && user.Domain.Name == domainName);

public IEnumerable<User> GetUsersFromCustomField(string fieldName, string fieldValue, string domainName)
return UserManager.GetUsers().Where(user => user.Profile.GetCustomProperty(fieldName) == fieldValue && user.Domain.Name == domainName);

//Get user by user name, it must include the domain.
public User GetUserByUserName(string domainName, string userName)
return User.FromName(String.Format(@"{0}\{1}", domainName, userName), false);

//Get user by email, first get the username for the email then get user by username.
public User GetUserByEmail(string domainName, string email)
var userName = Membership.GetUserNameByEmail(email);
return !String.IsNullOrEmpty(userName) ? GetUserByUserName(userName, domainName) : null;

//Check if a user exists
public bool DoesUserExist(string domainName, string userName)
return User.Exists(String.Format(@"{0}\{1}", domainName, userName));

//Get the current context user. This will by default be extranet\Anonymous if no one is logged in.
public User GetCurrentUser()
return Context.User;

Users Roles

public  IEnumerable<Role> GetUsersRoles(UserProfile profile)
return profile.ProfileUser.Roles;

public void AddRoleToUser(UserProfile profile, string roleName, string domainName)
profile.ProfileUser.Roles.Add(RoleHelper.GetRole(domainName, roleName));

public void RemoveRoleFromUser(UserProfile profile, string roleName, string domainName)
profile.ProfileUser.Roles.Remove(RoleHelper.GetRole(domainName, roleName));

public bool IsUserInRole(User user, string role)
return user != null && user.IsInRole(role);


public void AddUser(string domainName, string userName, string password, string email)
Membership.CreateUser(String.Format(@"{0}\{1}", domainName, userName), password, email);

public string GetUsersCutomProperty(User user, string fieldName)
return user.Profile.GetCustomProperty(fieldName);

//Update the Users default sitecore and custom fields
public void UpdateUser(UserProfile profile, string email, string fullName, string customFieldName, string customFieldValue)
profile.Email = email;
profile.FullName = fullName;
profile.SetCustomProperty(customFieldName, customFieldValue);

public void DeleteUser(User user)

Is authenticated, is administrator

//Method not required but here for completeness
public bool IsUserAuthenticated(User user)
return user.IsAuthenticated;

//Method not required but here for completeness
public bool IsUserAdministrator(User user)
return user.IsAdministrator;

Change and reset users password

public void ChangeUsersPassword(string userName, string currentPassword, string newPassword)
Membership.Provider.ChangePassword(userName, currentPassword, newPassword);

public static string ResetUsersPassword(string userName)
var membershipUser = Membership.GetUser(userName);
return membershipUser != null ? membershipUser.ResetPassword() : string.Empty;


//login without password
public void LoginUser(string domainName, string userName)
AuthenticationManager.Login(string.Format(@"{0}\{1}", domainName, userName), false);

//default login
public void LoginUser(string domainName, string userName, string password)
AuthenticationManager.Login(string.Format(@"{0}\{1}", domainName, userName), password, false);

public void LogOutUser()


//Roles are seperate per domain
public Role GetRole(string domainName, string roleName)
return Role.FromName(string.Format(@"{0}\{1}", domainName, roleName));

public IEnumerable<string> GetRoles()
return Roles.GetAllRoles();

public IEnumerable<string> GetRoles(string domainName)
return Roles.GetAllRoles().Where(r => r.Contains(domainName));