Calculated Site Column is dropped from Content Type when added to Document Library (SharePoint 2013 Solution)

1.5k views Asked by At

I have a SharePoint 2013 solution that is Site scoped with two features: "My Custom Site Columns" and "My Custom Content Types". I'm trying to create an additional site column within the solution that is calculated from another site column within the same solution. The new column is created successfully and appears in Site Columns and Content Types when viewed in Site Settings. But, when I add the content type to a document library, the content type is added but without the calculated column. Clicking through to the parent of the list content type show the calculated column was indeed in the parent.

One caveat is that the display name for the source column in the content type is different than the display name in the site column itself. (The same column is used in a number of content types but the display name may vary.) When I view the content type in Site Settings the column is there with the expected display name so I don't think this is an issue.

Does anyone have any insight in to why this is being dropped and what I can do the resolve this?

Source column definition:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
    <Field
      ID="{3eebbc0c-9406-4464-89fb-932604123xyz}"
      Name="SourceColumn"
      DisplayName="Source Column"
      Type="Text"
      Required="FALSE"
      Group="My Custom Columns">
    </Field>
  </Elements>

Calculated column definition:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field
      ID="{eb7246d4-559f-4931-8baf-bffa7dabc123}"
      Name="LastThree"
      DisplayName="Last Three"
      Type="Calculated"
      ReadOnly="TRUE"
      Group="My Custom Columns"
      ColName="sql_variant1" RowOrdinal="0">
        <Formula>=RIGHT([SourceColumn], 3)</Formula>
        <FieldRefs>
          <FieldRef Name="SourceColumn" />
        </FieldRefs>
    </Field>
  </Elements>

Content Type definition:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: z_ Parent Document (MyProject.ContentTypes\BaseDocument) (0x01010038589498EB414893AACEE02A8D57BF51001B144886ED474B048911CCE087654321) -->
  <ContentType 
    ID="0x01010038589498EB414893AACEE02A8D57BF51001B144886ED474B048911CCE087654321005AFF4C48FBB641AE862B074363C671D5" 
    Name="Custom Content Type" 
    Group="My Custom Content Types" 
    Description="" Inherits="TRUE" Version="0" ReadOnly="FALSE">
    <FieldRefs>
      <FieldRef 
        ID="{3eebbc0c-9406-4464-89fb-932604123xyz}" 
        DisplayName="Original Source Column" 
        Required="FALSE" 
        Name="SourceColumn" />
      <FieldRef 
        ID="{eb7246d4-559f-4931-8baf-bffa7dabc123}" 
        DisplayName="Last Three" 
        Name="LastThree" 
        ReadOnly="TRUE" />
    </FieldRefs>
  </ContentType>
</Elements>
0

There are 0 answers