Sitecore Blog: Getting to Know Sitecore

Rules Field Type and Sitecore 6.5

By Adam Conn, September 16, 2011 | Rating:  | Leave a comment

cep ruleset editor

Sitecore 6.5 introduces some great additions to the ruleset editor. One is built-in filtering, so you can quickly find the conditions and actions you are looking for. Another is the ability for the Rules field type to display conditions and actions or just conditions. This post explains how to configure a Rules field to support either option.

Sitecore has a field type named Rules. The user interface Sitecore provides for editing the value of a Rules field is the Rule Set Editor, which is similar to the rule editor available with Microsoft Outlook.

You add a Rules field to your template when you want a content author to be able to specify conditions and the corresponding actions to take if those conditions are met.

There are many cases where both conditions and actions apply. For example, if you're using rules to configure price discounts on products. The condition might be "if the visitor is a first time visitor or if the visitor hasn't been to the site within the last 6 months" and the action might be "discount the price 10%".

But there are also many cases where you only care about the conditions because the actions are implied. An example of this is conditional rendering. The conditions may vary, but the action is always "show content". In these cases, Sitecore would show conditions and actions. A content author could specify actions, even though Sitecore would ignore those actions.

That was how it worked in versions of Sitecore prior to 6.5. With 6.5 you have the ability to hide actions. This is configured using the Source field. Instead of just specifying the path to the rules you want to display you specify 2 parameters using query string notation:

  • rulespath - path to the conditions and actions to display
  • hideactions - true if you want to hide actions, false if you want to show actions
rule field



The following screenshot shows the Rule Set Editor with conditions and actions (rulespath=/sitecore/system/Settings/Rules/Notification&hideactions=false):

showing conditions and actions


The following screenshot shows the Rule Set Editor with the actions hidden (rulespath=/sitecore/system/Settings/Rules/Notification&hideactions=true):

showing only conditions



Tags: API, UI

*
*
*

Learn More with Sitecore

Newsletter
*

Velir | Read Case Study >

Using Sitecore as the hub for integrations contributed to a stable, maintainable, and well performing web site and allowed our team to build in parallel efficiently.

- Daniel DeLay, Senior Developer, Velir