Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anthonywhite opened this issue Nov 21, 2022 · 3 comments

Comments

@anthonywhite
Copy link

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?

@anthonywhite
Copy link
Author

@madsmai @friendbool any thoughts on this based on your recent fixes #721 or #627?

@davcano
Copy link

davcano commented Feb 14, 2023

Hello,

I have the same issue. The PnP Template works with the PnP.PowerShell 1.11.0 but not with version 1.12.0.

My column is created successfully at first, but when the Content Type is applied to the list, I have the error below:
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.

Is there any fix on that yet?

Best regards

@anthonywhite
Copy link
Author

I worked around this by moving the column from Site fields to list fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants