Sean Holmesby

.NET and Sitecore Developer

By

Sitecore Upgrade Post Step Scripts

Charlie Turano recently told me a lesser known fact about Sitecore’s upgrade process. There is a block of code that gets executed to update existing items in the database. This is what’s known as an installation ‘Post Step’, and it gets triggered after the new or changed items are added to the database.

For example, Sitecore 6.5 updated the ‘Placeholder Settings’ items to have a new ‘Placeholder Key’ field.
01 - Placeholder settings extra field Read More

By

DataFolder config patch for Sitecore Instance Manager (SIM) installs

The Sitecore Instance Manager (SIM) tool is a fantastic tool for quickly setting up local Sitecore installations. I love using it for quick setup when sandbox testing features, or new shared source modules from the community.
It’s so simple that you just click on the ‘Install Instance’ button, fill out the information for the site you want, and off it goes, extracting the webroot, attaching databases, setting up IIS and everything. It’s great!

01 - SIM Install

One thing I found when setting up my sites was that the Data folder was saved within the actual Web.Config, as opposed to it being patched in with an App_Config/Include file.

Read More

By

Sitecore Glass Mapper Data Handler for a Link List field

Here’s a way to map a custom Link List field in Sitecore to Glass.Mapper.Sc, for easy usage.
The following was used for Monoco’s Link List field but can also be used with the Field Suite’s General Links field by Velir, as it stores the same raw value.
(Note: for Monoco’s Link List field, it’s better to download the LinkList package from the Monoco site than the Sitecore Marketplace, as the Marketplace version is outdated at the time of writing this post).
LinkList

For more information on Data Handlers, check out the Data Handler tutorial on the Glass Mapper website here.
Read More

By

The Launch Sitecore Site using TDS

The Launch Sitecore site is a great shared source site that allows Sitecore editors and developers to check out a complete Page Editor and DMS friendly Sitecore solution. The site comes complete with Engagement Plans, User Profiles and Lucene Indexing, and the code and content can be downloaded by registering on the site, then going to the /download page.
Launch Sitecore

While playing around with the site, I wanted to have a play with a couple of things from the development side of things. I wanted to teach myself things with:-

As a result, I have created a GitHub repository that has the code from the Sitecore package in a Web Application solution, and have converted all of the items in the package into serialised items in TDS.
You can grab the repo from here:-
https://github.com/SaintSkeeta/LaunchSitecoreTDS

Read More

By

A little Razl Tip to help your efficiency

I’ve been using Razl a lot lately, and if you’re not also, you should definitely check it out.

I’m creating components with test data, which is being included in the TDS project, but being excluded from production builds. This means that I can create components and have test content available for debugging, and other developers can get the sites running locally with no visual issues.

Sometimes I may even have complete content on my local instance… where I’ve tested and confirmed it’s working, and the request will come in to push that to production. The request, of course, will come while you’re midway through programming another component…. so I want to save any time I can doing the push, and get back to my programming.

Read More

By

Sitecore Package ‘Installation was aborted by user’

Ever seen this error in Sitecore?

Installation aborted

Installation aborted

I have seen this all too often…. even when I haven’t cancelled the installation.
I always thought it was an error with my instance….and ended up installing the package via another means (Sitecore Rocks).

Mike Edwards quickly mentioned the issue to me when I was screen sharing with him about some other issue, and this came up. It was one of those ‘I can’t believe I didn’t know that’ moments.

Turns out the error is shown when files are being overwritten, and a popup window is attempted to be shown by Sitecore to allow you to overwrite the file.
If popups are blocked in the browser, the installation fails with this error.

I never knew this because sometimes the popup blocker notification isn’t shown very obviously in Chrome (see image below).

To fix this, click on the popup blocker notification to the right of the address bar, and allow popups.

popup blocker

Then reinstall the package, and you’re good to go.

By

Sitecore Development Tools

Last week I was honored to be a part of the Sitecore Development Tools Round Table discussion at the 2013 Sitecore Users Virtual Summit. Talking with a team of seasoned Sitecore developers, we discussed the tools and add-ons that we each use during our everyday Sitecore development.

Read More

By

Setting the Item SortOrder value in Sitecore Rocks Query Analyzer

This post discusses how you can utilize the Sitecore Rocks Query Analyzer to set the sort order of items in the Sitecore Content Management System.

In Sitecore, items are sorted by their value stored in the Standard Field __Sortorder. Typically, when adding items, Sitecore will separate these values by 100. Then when an item is resorted, Sitecore will determine where it is sorted to, and adjust it’s __Sortorder value accordingly. Usually this means splitting the difference between the sort order values of the items it has been placed in between.
01 - Sort Value

After many sort order changes, it’s possible that Sitecore will find it has run out of integers that it can split, so it will change all of the sort order values of the items to be 100 apart again, still keeping the same relative order.

It’s ok to be negative

One thing I found recently was that the __Sortorder field can contain negative values, and still function properly. You can manually set -5000 in the __Sortorder field on an item, and be fairly confident that it’ll be sorted to the top.

Even if you move an item above one that’s been set with a negative value, Sitecore will use a more negative value to ensure it can keep the order of items in check.

So when is this useful?

Sometimes reordering can be a tedious process, particularly if you have the same structure in multiple places.
Also, clicking and dragging each item, can be time consuming.
So how can you speed up the process?
You can write specific sort order code if you want them all the same. But that will require a build, and will always keep the sort order fixed to the way the code intends, not allowing manual changes later.

Or, if you just want to set it once, you can utilize the inline editing feature of the Sitecore Rocks Query Analyzer result set.

Grab all the items you’re after, displaying the __Sortorder field in the results.
02 - Query Analyzer results

Double click the cells for the items and set them to negative values.
03 - Editing Sort Order

Once that’s done you can refresh the content tree and see your items resorted the way you want them.
04 - Sorted items

By

Sitecore Publish Queue and Incremental Publish

I’ve recently been looking into the Publish Queue and using Incremental publish on our projects.
Out of the site publish modes available, Incremental publish is the quickest publishing option.

I wanted to look into how this works.
In the past we’ve always made our updates and individually published every changed item on it’s own. This can be very time consuming so I wanted to see if there’s a better way.

Ways to View the Publish Queue

Using the Sitecore API

I found some different ways to view the publish queue.

Beginning with Brian Pedersen’s blog post I wrote an application that simply lists the publish queue using his ‘current view’ method.

Sitecore.Data.Database master = Sitecore.Data.Database.GetDatabase("master");
Sitecore.Data.Database web = Sitecore.Data.Database.GetDatabase("web");
 
Sitecore.Publishing.PublishOptions options = new Sitecore.Publishing.PublishOptions(master, web, Sitecore.Publishing.PublishMode.Incremental, Sitecore.Globalization.Language.Parse("en"), DateTime.Now);
 
// Get all the publishing candidates
System.Collections.Generic.IEnumerable candidates = Sitecore.Publishing.Pipelines.Publish.PublishQueue.GetPublishQueue(options);

Using Sitecore Rocks

In Rocks you can access the publish queue through the context menu by right clicking on an item in Sitecore Explorer and choosing
Tools -> Publishing -> Publish Queue
Publish Queue - Sitecore Rocks
Publish Queue - Sitecore Rocks

Note: You can also access this quickly using Commandy or by adding the selection to your favourites if you use it often enough.

Looking at the SQL table dbo.PublishQueue

If you open up SQL Server and locate the Publish Queue table in your master database you can view all the entries that Sitecore has made to it.
Publish Queue - SQL Table

Comparing all the queues

When looking at these three options I found that I was getting slightly different subsets in each.
The largest set of results came from the SQL Server table, while the smallest set came from the API code.

I noticed the following:-

  • The SQL table could contain multiple references to the same item. I assume this means that the one item could have been edited multiple times, and been added to the table each time.
  • The Rocks Publishing Queue viewer contained singular references to all items found in the SQL table.
  • The API code gave a subset of the Rocks queue, and only listed items that had been updated relatively recently.

How does incremental publish work with the Publish Queue

The incremental publish works the same way as the API code above. I found that the API code only grabs items that were updated more recently than the date and time of the last incremental publish.
Sitecore stores the date and time of the last publish in the dbo.Properties table for every target database and language.
This can also be accessed in code using:-

Database.Properties.GetLastPublishDate(Database target, Language language)

Code Reference

This is also how the Incremental Publish works. Sitecore grabs all the items from the Publish Queue table that were modified more recently than the last publish date.

By doing this, only recently changed items (in the final workflow state) will be published.

By

Sitecore Access Denied Exception in the Content Editor

Recently I noticed a lot of the following errors coming through from our Sitecore content entry server.

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Sitecore.Exceptions.AccessDeniedException: Application access denied.
at Sitecore.Diagnostics.Assert.HasAccess(Boolean accessAllowed, String message)
at Sitecore.Shell.Applications.Analytics.TrackingField.TrackingFieldDetailsPage.OnLoad(EventArgs e)
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Sitecore.Exceptions.AccessDeniedException: Application access denied.
at Sitecore.Diagnostics.Assert.HasAccess(Boolean accessAllowed, String message)
at Sitecore.Shell.Applications.Security.SecurityDetails.SecurityDetailsPage.OnLoad(EventArgs e)

Read More