Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

[BUG] - Export Fields Lists - Calculated Fields exported before referenced Fields in Formula #2799

Open
JoaoAlmeidaPoa opened this issue Nov 3, 2020 · 1 comment

Comments

@JoaoAlmeidaPoa
Copy link

Thank you for reporting a bug. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. If you have a actual question, we would ask you to use SharePoint Developer Group at Microsoft Tech Community. Thanks!

Environment

[ X ] Office 365 / SharePoint Online
[ X ] SharePoint 2016
[ X ] SharePoint 2013
PnP Version 3.26.2010.0

If SharePoint on-premises, what's exact CU version: Any

Expected or Desired Behavior

When you run the command
Get-PnPProvisioningTemplate -OutputInstance -Handlers Lists -ListsToExtract $listArray -IncludeHiddenLists
You cannot control the order of the fields inside lists will be exported when you have fileds inside a list with Type Calculated, sometimes this field is exported before the Fields that are referenced in the formula, and when you try to use the command Apply-PnPProvisioningTemplate you get worng message like this:

Apply-PnPProvisioningTemplate : A fórmula se refere a uma coluna que não existe. Verifique se há erros de ortografia na fórmula ou substitua a coluna inexistente por outra existente.

Observed Behavior

the expected behavior is when run the command Get-PnPProvisioningTemplate the exported fields type calculated should be the last fields to be extracted for the Apply-PnPProvisioningTemplate works fine.

Steps to Reproduce

Create a list with Calculated Field that reference anothe field (like text, number) and make some calculations, and create another fields at the list.
Change the order of the columns.
Export using Get-PnPProvisioningTemplate
and try to apply into another site collection

I get a fragment of xml of wrong code and right code (changed manually) here.

Wrong
<pnp:Fields> <Field Type="Calculated" DisplayName="Idade" Description="Informe a idade do beneficiário." EnforceUniqueValues="FALSE" Required="FALSE" Hidden="FALSE" ReadOnly="TRUE" CanToggleHidden="FALSE" ID="{0f6a94aa-baf1-4139-bdb9-49a977a39849}" Name="Idade" StaticName="Idade" Format="DateOnly" LCID="1046" ResultType="Text" Percentage="FALSE" SourceID="{{listid:Assistência Farmacêutica CEAP}}" ColName="sql_variant1" RowOrdinal="0" Version="5"> <Formula>=[{fieldtitle:DataNascimento}]</Formula> </Field> <Field Type="DateTime" DisplayName="Data de Nascimento" Description="Informe a data de nascimento." EnforceUniqueValues="FALSE" Required="FALSE" Hidden="FALSE" ReadOnly="FALSE" CanToggleHidden="FALSE" ID="{266bd246-9f57-4e8e-95ea-cb838a34314f}" Name="DataNascimento" StaticName="DataNascimento" Format="DateOnly" SourceID="{{listid:Assistência Farmacêutica CEAP}}" ColName="datetime1" RowOrdinal="0" Version="1" />

Correct
<pnp:Fields> <Field Type="DateTime" DisplayName="Data de Nascimento" Description="Informe a data de nascimento." EnforceUniqueValues="FALSE" Required="FALSE" Hidden="FALSE" ReadOnly="FALSE" CanToggleHidden="FALSE" ID="{266bd246-9f57-4e8e-95ea-cb838a34314f}" Name="DataNascimento" StaticName="DataNascimento" Format="DateOnly" SourceID="{{listid:Assistência Farmacêutica CEAP}}" ColName="datetime1" RowOrdinal="0" Version="1" /> <Field Type="Calculated" DisplayName="Idade" Description="Informe a idade do beneficiário." EnforceUniqueValues="FALSE" Required="FALSE" Hidden="FALSE" ReadOnly="TRUE" CanToggleHidden="FALSE" ID="{0f6a94aa-baf1-4139-bdb9-49a977a39849}" Name="Idade" StaticName="Idade" Format="DateOnly" LCID="1046" ResultType="Text" Percentage="FALSE" SourceID="{{listid:Assistência Farmacêutica CEAP}}" ColName="sql_variant1" RowOrdinal="0" Version="5"> <Formula>=[{fieldtitle:DataNascimento}]</Formula> </Field>

@ghost
Copy link

ghost commented Nov 3, 2020

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

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

No branches or pull requests

1 participant