Skip to main content


Showing posts from December, 2018

Anatomy of Sitecore Business Rule - Macros

In previous posts, we talked about field syntax and the basic structure of business rules. This time we are going to dive into macros in the business rules. Macros are used as part of the business rule syntax. The syntax looks like this and calls for 4 parameters. [Property to set, Operator/Macro, AdditionalParameters, Display text].

When I first started working with business rules the difference between operator and macro was confusing. To add to this confusion some of the out-of-the-box macros are named with the term "operator" (like ListOperator who's configuration points to a class called ListMacro and the class implements IRuleMacro). Anything under the path /sitecore/system/Settings/Rules/Definitions/Macros should be a macro and should implement IRuleMacro.

Macros have the follow characteristics:

They inherit the IRuleMacro interfaceThe interface requires this execute method void Execute(XElement element, string name, UrlString parameters, string value)The execute m…

Anatomy of Sitecore Business Rule - Field Syntax

In the previous post, I talked about the general anatomy of Sitecore Business Rules. In this post, we will dig more into the rule itself and how you can set one up.

In the previous post, I mentioned the "special syntax" a rule has in the "text" field. Let's dig more into what this is. This is broken into 4 parameters, not all of which are required. 
Property to set, defines the public property of the class where we want to assign the value coming from the content author inputOperator or Macro, the operator we want to use to evaluate the condition. In this case, this will be a string comparison operationAdditional Parameters, this parameter will depend on the type of macro that we use, this could be a default text value if we are using the default macro,  it could be a default start path if we’re using the Tree macro (root=/sitecore/content/myitem)  – think of it like setting a field source when we’re building a template in Sitecore. A full list of macros can be …

Anatomy of Sitecore Business Rules

A powerful part of Sitecore is the business rules engine. Many say it is an underutilized part of the platform. I think part of this is because it is not very well documented. I agree it is a very powerful part of Sitecore so I wanted to spend some time digging in and documenting more about how it works and how to utilize it.

First, let's level set at a high level on what this is. I don't want to rehash the intro stuff as Sitecore documentation does a good job at explaining it at a high level. The documentation that is slim is breaking down how it is configured and how to extend it.

There are a few blogs out there that show quick and dirty examples of how to create custom rules. Before we go there though I want to break down the anatomy of a rule that currently exists. I think this helps level set how a rule comes together. Once we understand its parts it is easier to create our own, and then the power is really unleashed.

Using a rule There are many places where a business ru…

Install Sitecore SIF

This is a pretty straightforward task so this will be short but here are a few commands to help you out, because if you don't know or can't remember a searching you must go.

First, make sure to launch Powershell in Admin mode.

Register the Sitecore Gallery
Register-PSRepository -Name SitecoreGallery -SourceLocation SIF Install-Module SitecoreInstallFrameworkUpdate SIF Update-Module SitecoreInstallFrameworkRemove SIF 
The reason here is version 1 and version 2 do not play nice together unless you specify the version you want it to use Install-Module -Name SitecoreInstallFramework -RequiredVersion x.x.x Uninstall-Module -Name "SitecoreInstallFramework" -AllVersionsVerify what has been installed/registered Get-Module SitecoreInstallFramework –ListAvailable