Wednesday, April 15, 2015

Sitecore setting up a visual studio solution

Once you have Sitecore installed you will need a visual studio solution to develop in, this post will cover the steps required to create the solution and deploy to the Sitecore web site. Microsoft Visual Studio is required and in this example I am using 2013 Professional. These instructions will cover a web forms based solution as well.

Setting up the solution

  1. Open up Visual Studio and select File > New > Project
  2. Select ASP.NET Empty Web Application and give the project a name
  3. Under the Web.config item select Web.Debug.config and Web.Release.config and right click then Delete.
  4. Click on the Web.config item and set the Build Action to None. This is done because Sitecore has it's own configuration file and we don't want to overwrite it with this one.
  5. Now the Sitecore DLL needs to be added to the solution and referenced, create a folder in the solution and name it "Sitecore".
  6. Navigate to the root of your Sitecore web site (you can do this by clicking Explore on IIS), then go into the Website/bin folder. Copy "Sitecore.Kernel.dll" and "Sitecore.Kernel.xml" into the folder created in the previous step (ensuring you include them in the project as well).
  7. In the project right click on Reference and then click Add Reference.
  8. Click Browse and then select the Sitecore.Kernel.dll from the Sitecore folder added to the current solution. Click OK.
  9. Select the newly added reference and set the Copy Local property to false. The DLL does not need to be deployed to the web root, as Sitecore already has it setup.
  10. The solution creation is now complete. You can now start adding any resources/layouts as required.

Publishing the solution to the Sitecore web site.

In this example I am developing locally so am able to make use of one click publishing.
  1. Right click the project name (in this case MySitecoreSite) and click Publish.
  2. Select Custom and give the profile a name - such as Local Deploy
  3. Select File System as the deploy option using the ellipsis (...) you can either select the IIS entry for the Sitecore web site or manually choose the file system location
  4. Click Next and set the configuration to Debug (if a development environment).
  5. Click Next again and then Publish. The solution will now publish to the Sitecore web site and any created layouts will be available for use. 
  6. Any time you click Publish on the project name, it will happen instantly as these steps only need to be followed once.

Other notes

  • In the past the solution would actually be created in the root of the Sitecore web site. The downside to that method is that source control is harder to use and it can be more difficult to recreate a new Sitecore instance and deploy the code.
  • TDS (Team Development for Sitecore) project(s) can be added to the same solution.
  • If you ever upgrade Sitecore versions, the Sitecore DLL(s) added to the solution will need to be updated as well.

Sitecore 8 defining placeholders, referencing them on a layout and adding a control

In Sitecore a placeholder can be added to a layout or sub-layout and put simply allow controls to be added to an area of the page. In the page editor the policyholder will have an option for the user to add to here, where they can then add add a control - these controls can also be locked down at the placeholder level to only allow certain controls in certain areas.

Define the placeholder by creating placeholder settings

  1. Log into Sitecore admin and open up the content editor.
  2. Under layout select placeholder settings.
  3. Click Placeholder to create a new placeholder settings definition
  4. Enter a name (key) for the placeholder - this is what it will be referenced as, so be descriptive
  5. If required you can now set the allowed controls and a description for the placeholder

Reference the placeholder on your layouts

Now that the placeholder has been designed, it needs to be added to a layout so that it can be used. On the control the following would be added for a web forms layout to reference a placeholder with a name/key of main.
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<sc:Placeholder runat="server" Key="main" />
 For MVC the following would be used:

 Use the placeholder to add a control

Now that a placeholder setting has been defined and the placeholder has been added to a layout, any Sitecore item which uses that layout can now add a control. This can be done in the page editor or in the content editor using the following steps:

  1. Navigate to the Sitecore item you wish to add the control to.
  2. On the Presentation tab select Details.
  3. Ensure the correct layout has been setup for this item (the one the placeholder was placed on), and then click edit under controls
  4. On the left select the Controls tab and then the Add button.
  5. Now select the control (sublayout or rendering) and enter the name/key of the placeholder.
  6. Click Select, then Ok and Ok to close the dialogues. After a publish your control should now appear as expected on the Sitecore item/page.

Monday, April 13, 2015

AngularJS radio button not working in ng-repeat repeater

In AngularJS the ng-repeat element will create it's own scope. This means that if you try and access an ng-model on a radio button element in an ng-repeat repeater, the value would come back undefined. This can be fixed by simply setting the ng-model of the radio button to be prefaced with "$parent.", this then sets the model in the parent (aka where your main controller is).
<input type="radio" name="MyRadio" ng-model="$parent.MyModel" value="{{i.Value}}" /> 

How to utilize marketing features in Sitecore to deliver a better web experience


The common goal of many companies web sites is to sell a product/service or to provide information. In terms of selling a product or service each sale equates to revenue for the company, so ideally the web site needs to deliver a good experience that maximizes sale and minimizes bounces. When it comes to providing information, each user is different and may get disinterested if bombarded with too much information (including that which is irrelevant to their situation), therefore it becomes important to provide the right information at the right time. Sitecore comes with the AIDA platform (Analysis, Insights, Decisions and Automation) which provides a powerful set of features which ultimately can lead to higher sales and also provide a more personalized experience which tailors the web site (and it's content) to each individual user.

In this post I am going to explore a few of my personal favourite features available in Sitecore AIDA, and provide generalized examples of how they can be used to improve your Sitecore web site. It is also worth mentioning that Sitecore AIDA is available out of the box and does not require any additional licensing or cost. Many of the tools can be used by content editors and marketers with none to little developer effort required - however as with anything, more complex solutions can require developer effort.

A/B and multivariate testing

When it comes to design and even the specific wording used on a page, different people will have different ideas about what will work best. At times heated arguments can start based on what colour the buy now button should be, but A/B and multivariate testing can solve this issue. Sitecore allows you to use A/B testing to test multiple versions of an item (text, style, image, etc.) to see which has better results. Not only can these results be measured on number of clicks or a goal conversion, but Sitecore is uniquely able to measure which multivariate leads to more engagement (meeting more goals and scoring higher on Sitecore's experience analytics) of the users. 

This testing can be set-up easily in the content editor and does not require a developer write any code, and once the test is finished you can immediately use the best result. In terms of sales and goal conversion A/B testing is a great way to refine many areas of the web site to see what works and what doesn't when it comes to sales and lead generation. I have seen cases where the colour/text of a button, the style of logo and the wording of copy can directly increase the sales of a product or service. Sitecore adds more to the mix with their insight into user engagement and strong analytics tracking. 

Goal tracking

With Sitecore you are able to set numeric values to activities on your web site - such as downloading media, completing a form, or even visiting a given page. Once the user has hit the required goal, the marketing automation can then perform an activity. This activity may be as simple as sending an email, or creating an action in a CRM to have customer service call the user, personalized content can also be activated. These actions all happen in real time and once set-up require no intervention from developers or content editors alike. 

With goal tracking you could track that a user has made a support request and therefore prioritize FAQs and other support content. You could also track that someone is downloading marketing assets and schedule a sales call or even email. With shopping carts or checkouts, you could track users who enter the cart but don't checkout and send them an email with discount coupon. 

Rules based targeting

With Sitecore there are a number of rules available that allow you to display different content based on whether or not the user meets the rule. For example you could use the geo-location of the user's IP address to display different contact details on a contact page. Language selected can also be used to show different content (language based versions of the same content is by default, this would allow different blocks that might only be in that language). Even with anonymous users, Sitecore allows you to match the users to a specific pattern and personalize the content to their interests. Rules based targeting is again set-up at the content editor level and the only time you would need a developer would be if you had a custom rule or business logic that needed to be set-up. An example of a custom rule might be personalizing the content based on what version/type of product the customer owns.

Behavioural targeting

A web site can contain a multitude of information that varies across many categories and sub categories. As a user you might only be interested in content relating to one of those categories, but instead are forced to view content that does not interest you, or is completely irrelevant. With Sitecore's behavioural targeting, the CMS is able to detect what types/categories of content the user is visiting and then show them content/pages related to those types/categories. This personalization is a very powerful sales tool that allows you to target highly relevant content to users that you know they are actually interested in.

Sitecore tracks the user's movements and other variables building a customer profile (for both anonymous and registered users) which is then used for the behavioural targeting. This profile can then be used across other mediums such as email and social channels to further provide relevant content to the user. In the case of a vehicle sales web site, you could track what types of vehicle the customer is browsing (minivan or sports car for instance) and begin to promote that type of content on the web site. Furthermore if it was a registered user, you can begin to customize newsletters and other channels to further promote that type of vehicle.

Profile scoring

Using multiple parameters which include pages visited, emails clicked, media downloaded; Sitecore is able to build a profile score for each user. Profile cards allow content editors to assign attributes to each piece of content, which then allows site users to build a score and start getting matched against user defined customer profiles. Once they match a profile, you can personalize the entire web site specifically for that profile. Like rules based or behavioural targeting, profiles can change as the user's habits do, however the key benefit is that content personalization is linked to the profile, meaning if the profile changes you only need to update in one place (rather than each content personalization manually).

The profiles can also be used to pass leads onto sales teams via CRM. Not only are you sending through a qualified lead that you are sure is interested in the product, but the sales team can easily see what pages the user visited, what media they downloaded and what emails they have clicked.


Unlike many other content management systems, Sitecore is not another one trick pony that simply manages content. It has a large range of features which make it arguably the leading CMS, and this includes the AIDA platform. In this post I have covered just a few of the available features in Sitecore AIDA, yet it should now be very clear just how powerful they are for both sales and information based web sites. Don't get left behind of your competitors by providing a poor web experience for your customers and site browsers, utilise Sitecore and it's AIDA platform to deliver a better web experience.

Friday, April 10, 2015

Indexing a list field in SharePoint

In a previous post, I had an error with users querying a large list due to the List View Threshold. Instead of increasing the list view threshold for non administrative users, I opted instead to index a key field on the list.

To index a field on a SharePoint list, the following steps can be followed:

  1. Navigate to the list you wish to index
  2. On the ribbon select List and then List Settings
  3. Below the list of columns you will see a link titled Indexed columns, click this
  4. Click Create a new index
  5. Here you can select up to 2 columns to index and then click create
Generally you would index the key column(s) which are used for looking up data. In my case there was a username field (which I would query with CAML to return all rows associated to that user). Once the index had been created there was no error related to the list view threshold.

SharePoint The attempted operation is prohibited because it exceeds the list view threshold

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
SharePoint introduced the view list threshold to protect the server from unintentional load caused by large queries. For example querying a list of 25000 items could cause a lot of load, especially when multiple users are performing this action. In central admin there is a list view threshold setting for both administrators and general users. This can be found by:

  1. Log into central administration
  2. Go to Application Management and then Manage Web Applications
  3. Pick the web application which you want to change the setting for
  4. On the ribbon select General Settings and then Resource Throttling 
  5. Now the LVT can be set
It's not recommended to set the List View Threshold higher as it can lead to load and performance problems. If you have a large list that needs querying, indexing fields may help with the problem.

Tuesday, April 7, 2015

SharePoint list query is returning all items

To save time when querying lists in SharePoint, I create a view and then use SharePoint designer to get the CAML query for that view. This CAML can then be used programatically to query the list. An interesting feature I came across is that when the query tags <query> and </query> are left in the CAML, the query will always return all items in the list. To get the query to work correctly, simply remove the query tags and ensure the CAML begins with <where>.