Skip to content

Calculated field not added to content type with feature deployment #9871

@EA12

Description

@EA12

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version : Version 127.0.2651.98 (Offizielles Build) (64-Bit)
  • SPFx version 1.19.0
  • Node.js version: 18.19.0

Describe the bug / error

A calculated field is not added to the content type even when defined in the elements.xml

Steps to reproduce

  1. Deploy two number fields
  2. Deploy a calculated field with resulttype=number which calculated the two previous mentioned fields
  3. Add these three fields to a content type which you attach to a custom list.
  4. After deployment you see that the calculated field has been deployed as site column, but is not attached to the content type.
  5. It is then possible to manually add the calculated field to the content type by UI

Field Definition:
<Field ID="{ed8aee2b-10c7-4dd0-bff1-5f240c8814f2}" Name="IRCO2Before" DisplayName="CO2-Verbrauch vor Investition" Type="Number" Decimals="0" Min="0" Group="Invest" /> <Field ID="{116ca0de-e899-45d8-9caf-21c821b46f00}" Name="IRCO2After" DisplayName="CO2-Verbrauch nach Investition" Type="Number" Decimals="0" Min="0" Group="Invest" />

Calculated field definition:
<Field ID="{c7bc0183-8ca4-46d5-b138-882e1033f573}" Name="IRCO2Impact" DisplayName="CO2-Impact in kg/Jahr (Einsparung (-) bzw. Mehrverbrauch (+))" Type="Calculated" ResultType="Number" ReadOnly="TRUE" Group="Invest"> <Formula>=IRCO2After-IRCO2Before</Formula> <FieldRefs> <FieldRef Name="IRCO2After"/> <FieldRef Name="IRCO2Before"/> </FieldRefs> </Field>

Content type definition part:
<FieldRef ID="{ed8aee2b-10c7-4dd0-bff1-5f240c8814f2}" Name="IRCO2Before" DisplayName="CO2-Verbrauch vor Investition"/> <FieldRef ID="{116ca0de-e899-45d8-9caf-21c821b46f00}" Name="IRCO2After" DisplayName="CO2-Verbrauch nach Investition"/> <FieldRef ID="{c7bc0183-8ca4-46d5-b138-882e1033f573}" Name="IRCO2Impact" DisplayName="CO2-Impact in kg/Jahr (Einsparung (-) bzw. Mehrverbrauch (+))"/>

Expected behavior

The calculated field should be attached to the content type.

Metadata

Metadata

Assignees

Labels

Needs: Author FeedbackAwaiting response from the original poster of the issue. Marked as stale if no activity for 7 days.Needs: Triage 🔍Awaiting categorization and initial review.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions