pnp / pnp/pnpframework

Framework 1.11/PowerShell 1.12 Calculated Column Error: The formula refers to a column that does not exist

Open
#794 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

PnP Framework 1.11 or PnP PowerShell 1.12
(NB Xml reduced to essentials with GUIDs etc. omitted)
PnP Template with:

<pnp:SiteFields>
<Field Type="Text" Name="StatusField" DisplayName="StatusField" StaticName="StatusField"/>
<Field Type="Calculated" DisplayName="CalcField" Decimals="0" ResultType="Number" StaticName="CalcField" Name="CalcField"  ReadOnly="TRUE">
          <Formula>=IF([{fieldtitle:StatusField}]="Closed",1,0)</Formula>
</Field>
</pnp:SiteFields>
<pnp:ContentTypes>
        <pnp:ContentType Name="MyCT" >
          <pnp:FieldRefs>
            <pnp:FieldRef Name="StatusField" />
            <pnp:FieldRef Name="CalcField" />
          </pnp:FieldRefs>
        </pnp:ContentType>
</pnp:ContentTypes>

When the MyCT Content Type is applied to a <List> in the template, this error is displayed:

Invoke-PnPSiteTemplate: The formula refers to a column that does not exist.  Check the formula for spelling mistakes or change the non-existing column to an existing column.

The same template works with PnP Framework 1.10 or PnP Powershell 1.11, and the Content Type works when applied to a list using the SharePoint UI.

Is this caused by the change(s) to the way Calculated Columns are handled in latest Framework?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Invoke-PnPSiteTemplate entry point and reproduce the issue with the supplied PnP template across Framework 1.10/1.11 and PnP PowerShell 1.11/1.12. Compare how the calculated column formula referencing StatusField is handled when MyCT is applied to a list. Done means the template applies successfully in the newer versions and the calculated column retains the expected formula behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.