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

Error "The formula cannot refer to another column" when applying list template containing fields with validation #849

Closed
elenanakhmanson opened this issue Nov 18, 2016 · 1 comment

Comments

@elenanakhmanson
Copy link

Category

[ x] Bug
[ ] Enhancement

Note: it's not a bug because of a provisioning engine but because of how SharePoing handles validation formulas.

Environment

[ x] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

Expected or Desired Behavior

The validation formula of fields need to have display names of a field and not an internal name.

Observed Behavior

We get error "The formula cannot refer to another column. Check the formula for spelling mistakes or update the formula to reference only this column." when we apply a template generated by the provisioning engine. The field is a normal text field that belongs to a list (not a Site Column) and that has a validation formula. The field was created in UI and functioning fine. We found that when we get a SchemaXml of a field, the validation formula contains InternalName of a field, but when a field is created using AddFieldAsXml method, validation formula is expected to have DisplayName of a field in square brackets. So it's not really a problem with proivisioning engine, but nevertheless, it crashes when applying a template.

Steps to Reproduce

Create a text field in a list and add validation formula that refers to the same field.
Generate a provisioning template from the site with the list
Apply generated provisioning template to another site.

Sample field xml from the provisioning template which is in a :

=(LEN(LEFT(Email,FIND("@",Email)-1))>0)+(LEN(RIGHT(Email,LEN(Email)-FIND(".",Email,FIND("@",Email))))>0)+(LEN(MID(Email,FIND("@",Email)+1,FIND(".",Email,FIND("@",Email))-FIND("@",Email)-1))>0)+(ISERROR(FIND(" ",Email))=TRUE)=4

luismanez added a commit to luismanez/PnP-Sites-Core that referenced this issue Jan 15, 2017
@jansenbe
Copy link
Contributor

Closing this issue now that #976 has been merged

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

No branches or pull requests

2 participants