Sitecore Rules Engine: How to create an insert option rule

You can automatically add a insert option using a insert option rule in the Sitecore Rule Engine.

The ‘case’:
In our Sitecore content tree we have a Meta-Data folder where we store al our meta-data information. The Meta-Data folder is organized in folders which contains meta-data items based on a template called Standard Text. What we want to achieve is that when a new folder is created within the Meta-Data folder the Standard Text template will be automatically available as insert option.

Open the content editor and find the Rules folder:
/sitecore/system/Settings/Rules/Insert Options/Rules/

In the Rules folder create a new Insert Option Rule named Meta-Data rule.  For the name enter Meta-Data rule and click, the Rule Set Editor will open.  Select the condition Where the parent name compares to value and for the action check Add specific insert option.  Specify the rule that it will look like this:
sitecore rules engine insert option rule

We don’t have to specify or activate the rule for the Meta-Data folder because the insert Option Rules will be automatically processed by the GetInsertRule pipeline.

Now test the result and create a new folder underneath the Meta-Data folder and check if the Standard Text template is added to the insert options.
sitecore rules engine insert option rule result

This article is based on a Webinar (in Dutch) I did about the Site Rules Engine you can see the Webinar on YouTube and read the related post: Sitecore Rules Engine: How to create a custom condition

[youtube]UWYTtDyM3WM[/youtube]

Cheers,
Pieter

Leave a Reply

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