“Inheriting” Metadata on Organizational Items

Recently I had a customer ask me for a rather simple feature – the ability to have Tridion folders and structure groups inherit the metadata schema and values from their parent. This would be only when creating new organizational items and obviously we want to show these default values on screen when editing.

Having spent the past few months completely buried in Anguilla/CME extensions, I obviously started thinking of implementing this by extending a whole bunch of Anguilla Commands and going all crazy on Javascript.

And then it hit me that perhaps, just perhaps, I was making it more complex than it has to. After all, it’s just setting a default value, right? The Tridion CM Core team must have thought about this.

And indeed they have. The solution is so simple I almost feel ashamed I didn’t find it before.

Event Registration:

EventSystem.Subscribe<OrganizationalItem, LoadEventArgs>(SetDefaultValues, EventPhases.Processed);


private void SetDefaultValues(OrganizationalItem subject, LoadEventArgs args, EventPhases phase)
    if (subject.Id.IsUriNull) //Is new
        OrganizationalItem parent = subject.OrganizationalItem;
       if (parent.MetadataSchema != null && subject.MetadataSchema == null)
            subject.MetadataSchema = parent.MetadataSchema;
            subject.Metadata = parent.Metadata;

7 thoughts on ““Inheriting” Metadata on Organizational Items

  1. Good one. Thanks for sharing this, Nuno.

    When I subscribe to the above event handler during ”TransactionCommitted’ ‘ phase of the load event, it gets called. Why is there a ‘TransactionCommitted’ phase during the load event?

  2. @Premkumar, I assume this is for consistency more than anything else. Processed vs TransactionCommitted on a load event doesn’t indeed make much difference (maybe it does internally) but I think it would have been worse to NOT implement TransactionCommitted – again, for consistency across events.

    Like this you can say that the LAST phase for a successful event is always TransactionCommitted, instead of having to go through the pain of explaining “except if this is a load event or a load application data event or etc…”

  3. that’s awesome for copying all metadata from the parent. but, what happens when the business folks change their mind and only want SOME of the metadata copied… :) trying to modify the solution to accommodate for that now.

  4. Pingback: Inherited Page Workflow Process Settings On Structure Groups | Coded Weapon

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>