1

I would like to know if there is any way to merge the field of a parent template into the child template's existing section. Here is the scenration

Template A has a field under Main Section(FieldA).

Now this template needs to be inherited by 3 another templates (B, C, D). When I do, I want to get the FieldA as part of existing sections of Template B, C, D.

Reason being if I don't merge the field, when I use these child template on an item, I see "FieldA" under "Main" section thrice and its confusing to user as to which template's "Main" section is being edited \ added.

  • 1
    Can you provide screen shots please? Specifically, of each template's builder, and then subsequent's base template field – Pete Navarra Jan 31 '18 at 6:55
  • Fields show up in sections named the same. So you would need to move your field to a section named the same as a section on your templates B, C and D for the field to show up there. But generally speaking, your Information Architecture is very wrong, to even end up in problems like this. – Mark Cassidy Jan 31 '18 at 8:47
3

Understanding The Problem

Parsing your question I think I see where your issue is coming from. To reiterate, for the purposes of this answer, you have 4 Templates:

Template A
    Section Main
        Field A
        Field B
        Field C

Template B
    Section Main
        Field A
        Field D
        Field E

Template C
    Section Main
        Field A
        Field F
        Field G

When Template A is added as a Base Template of Template B, the resultant set of fields on the item based off of Template B looks like:

Item X (Based off of Template B)
    Section Main
        Field A
        Field A
        Field B
        Field C
        Field D
        Field E

Field A is showing up twice because there are two templates with the same name that are inherited by this item.

Correct Way to Inherit Fields

Using the above scenario, the proper way you want to construct your templates should look something like this:

Template A
    Section Main
        Field A
        Field B
        Field C

Template B (Inherits A)
    Section Main
        Field D
        Field E

Template C (Inherits A)
    Section Main
        Field F
        Field G

The resulting item will look like this:
Item X (Based off of Template B)
    Section Main
        Field A
        Field B
        Field C
        Field D
        Field E

Tips

  • Fields will be merged across inherited templates based on the Section Name that the field resides under. If the Section Names match, the field will go there.
  • Use the Sortorder field to arrange the order that the fields show up on the Item in Content Editor. This also affects the ordering in the Field array on the Sitecore.Data.Item.
  • Do NOT inherit from templates that contain fields with the same name. Instead, split off those fields that are duplicated and put into their own template to be inherited from the templates needing those fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.