Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2022/missing-insert-options

What happened to my Insert Options?

Proof that just because I've been doing this for a decade, I do not know it all...

Published 07 November 2022

I had a moment of confusion with broken Insert Options recently, which made me wonder whether I ever knew the answer behind the issue or whether I'd just forgotten it over the many years I've been working with this CMS. Either way, this needs writing down to help me remember it in the future...

The problem

I had merged the latest develop branch for a project I was working on, as I got ready to do a PR for some work. As is my habit in docker-based projects, I restarted my containers with an empty database and did a full sync of serialised data to make sure that the changes to that Unicorn data were correct.

But when I spent some time checking the content tree, I noticed I was missing insert options on one particular item:

Content Editor showing no insert options for the current item

But when I went to look at the Data Template for the item, I could see the relevant options:

The standard values for the data template show the correct insert options

The __Standard Values item has the right settings, and the content item uses the right Data Template.

The answer

I'll admit I was a bit confused by this. Why would the correct Data Template not give the correct result? I went through a load of checks, like making sure the item wasn't overriding the data template. But after a while I gave up banging my head against it, and asked my colleague Martin Davies. And he got to have a moment of brilliance by immediately knowing what the issue was:

He said "have you checked the Standard Values field?"

And I had a moment of head scratching. In my head, the __Standard Values item was tied to the Data Template by being its child. Why would there be a field for it? But Martin is right - the field is there (Turn on "Show Standard Fields" and look at the end of the "Advanced" section) and it's empty for my broken template:

The Standard Values field in the Content Editor

And when I change the value of that field to link to the correct __Standard Values item:

The correct value put back in the Standard Values field

I get my insert options back:

The correct Insert Options back for the previously broken item

Success!

Why did this happen?

Well, I'm not sure, to be honest. But my best guess is something merge-related lead to the loss of this value from the serialised Data Template item. So when I did my Unicorn sync, I ended up without this value - even though it should have been there originally. (And was in my database before my merge & sync))

But problem solved, and knowledge gained. So all good...

↑ Back to top