Sean Holmesby

.NET and Sitecore Developer

By

How to fix missing Conditions and Actions in Rules fields in Sitecore 7.1

Update: I found a bug in the Sitecore 7.1 Upgrade Process that causes the issue mentioned in this post. An explanation and a fix for the process can be found at my Github repository, https://github.com/SaintSkeeta/Hedgehog.SC71Upgrade.

I previously posted about the Sitecore Upgrade ‘Post Step’ code that gets executed on items when upgrading Sitecore to a newer version. The Post Step code in the Sitecore 7.1 upgrade processes the Conditions and Actions items for Rules fields…meaning your existing Rules fields may be affected during the upgrade process.

When Sitecore 7.1 was released Adam Conn wrote a blog post about the changes to how Rules work in the new update. With everything shifted around in the content tree, I knew there would be some sort of Post Step to update existing Rules items.

My LaunchSitecoreTDS repo (taken from the Launch Sitecore demo site) has a custom action that automates the enrollment of a user in an engagement plan, so with the package originally being built for Sitecore 7.0, something was going to happen with the items when upgrading to Sitecore 7.1.

The ‘Enroll in Automation State’ item had moved from:-

/sitecore/system/Settings/Rules/Common/Actions
to
/sitecore/system/Settings/Rules/Definitions/Elements/Custom

The action was originally setup to be executed on the Register Goal in the Marketing Center.
But now Rules fields respond to their ‘Rules Context’ (their Source on the field), allowing developers to limit what conditions and actions are available for a given rules field….
So now our custom action cannot be added to any other similar Page Events we setup, because it isn’t set as the Source for any field.

01 - Missing Source rules
Note the missing custom action from the right panel.

So for this action to be able to be added to Page Events as it was in Sitecore 7.0, we need to create a new Tag definition item under the Page Events node. This item just points to the ‘Custom’ tag, located here:-
/sitecore/system/Settings/Rules/Definitions/Tags/Custom

04 - New tag item

This tag is referenced by the Tags Definition item that lives alongside our custom enrollment action.
/sitecore/system/Settings/Rules/Definitions/Elements/Custom/Tags/Default

02 - Adding the tag

Now checking the Page Event items again, we can see that our custom action is now available to be added to the Rules field.

03 - Now selectable custom rules

Success! Editors can now select our custom action from the right panel of the rules set editor!

Note, this change has been included in my LaunchSitecoreTDS Github repo (tag version 2.0), but doesn’t exist in the regular LaunchSitecore site package.

Jeroen Huizinga followed a similar process when fixing Rules fields with the Mobile Device Detector module for Sitecore 7.1.

Leave a Reply

Your email address will not be published. Required fields are marked *