Dynamic insert options
Insert options, everybody know what does mean :) This is the place where we can make content editor life happier. We can prepare options in Content Editor context menu, to add new item based on some dedicated template.
It looks like image below.
Ok, so we have insert option, we have even put there some our custom template to create datasources. But what if we want to have only one instance of this item in this particular place ? Insert option allows to put as many we can, it doesn't say "Mate, only one is possible here". Is it possible to do that?
Well, yes it is :)
To make this dynamic option, we will use Rule Engine in Sitecore!
1. Rules for Insert Options.
To find rules we have to go to the path:
/sitecore/system/Settings/Rules/Insert Options/Rules
In that place we can find something looks like:
To create new item, just click on Rules parent item and chose "Insert Option Rule". When we create this item, we can go to the field "Rule" and click it. This action will open a dialog when we can build our custom rule.
2. Rules Queries
Rules can as custom as we want. Only constraint can be your imagination. In our case it will be condition, if item (as an instance of our template) has been already added to this particular place, or not. To do that we can write query like:
Voilà, we have dynamic insert option in our application and new friends in content editor team :)

About Robert Dębowski
Sitecore MVP 2018, MVP 2020
Winner of international Sitecore Hackathon 2018,
Co-Organizer of Sitecore User Group Poland,
Highly motivated Sitecore Team Leader and Architect with over 10 years of experience.
I’ve worked as project architect and consultant, who always advice to find the best solution for client issues. I take care of building best user experienced content management applications. As a team leader and Agile approach enthusiast, for whom each team member is important.
I have a lot of professional Sitecore development experience. I work with Sitecore since 2014, as a developer and afterwards, team leader and architect.
You May Also Like:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment