1

Anybody out there with a good understanding or a good reference of how the attributes that make up a custom list definition apply to the list columns when you define Fields and FieldRefs in multiple places. For example, it is not uncommon to have a custom list definition where you have ElementManifest files that define the attributes in many places, such as:

  1. Fields.xml - defines Field elements that become site columns
  2. Elements.xml - for each content type, defines FieldRef elements that reference the site columns
  3. Schema.xml - for each list definition that define Field and FieldRef elements that reference the list columns and content types

In each of those, you can define attributes on the Field and FieldRef elements such as Required="TRUE", ShowInNewForm="FALSE", etc... When you have it defined in multiple places for the same field (same ID and InternalName), which attribute will end up being the one you see on the list. While I was thinking that the precedence of how those attributes apply would go in the order of site column - site content type - list content type - list column that doesn't seem to be the case. Looks like whatever you put in the site column definition (Fields.xml) has the highest priority and can’t be overridden in elements that define list columns. It takes a lot of trial and error to get those things right, I was wondering if somebody has gone through the effort of testing the different combination and sharing the results.

    1 Answer 1

    1

    The way I have observed it to work is that the most narrow scope takes precedence. In other words, the Field defined in the list definition takes predecedence over the the definintion in the content type, takes precendences over the site column. And if you really want to get tricky, you can override a parent content type's field in a child content type.

    However, if the field is "Sealed" at any level, anything below that is ignored.

    2
    • Thanks for your input. It is interesting, because my experience so far is to the contrary. If I have a <Field ShowInNewForm=... /> in elements.xml that defines site columns and in elements.xml that defines list fields, it is the site column attribute that takes precedence. However there may very well be another attribute that plays a role, like the Sealed attribute you mentioned. I do not have that though in any of the Field or FieldRef elements.
      – Tom
      CommentedSep 30, 2011 at 9:00
    • It may very well be that some of the attributes behave differently than others. I can only say for certain that I have overridden either the display name or required attributes.CommentedSep 30, 2011 at 15:47

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.