Description
Didn't see this issue posted so thought I'd share my experience and workaround. I encountered this error attempting to migrate a list containing calculated list columns:
[Error] The formula contains a syntax error or is not supported.
Apply-PnPProvisioningTemplate : The formula contains a syntax error or is not supported.
At C:\.....\Move-Lists.ps1:124 char:9
+ Apply-PnPProvisioningTemplate -Path Lists.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
+ FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate
Since it choked in the middle of list provisioning, I looked at the migrated list and saw only a portion of the expected fields were provisioned just shy of where the first calculated field should have been created. I looked at the Calculated field types with Formulas in the Lists.xml and noted that fields were being referenced as such : [{fieldtitle:InternalName}]
Did some digging and found similar issues reported with Apply-PnPProvisioningTemplate such as this post suggesting that a difference between how the field is defined vs what PnP provisioning expects and suggested changing [{fieldtitle:InternalName}]
to just [DisplayName]
as workaround.
As such I reran the migration, this time using the Prepare-Deployment-Package-For-Client script vs RunAllScripts so I can edit the Lists.xml before continuing on. Made the changes in the package and continued with running Convert-packages.bat and it successfully completed. Confirmed the target list looked good then finished off by importing my power apps form.