Creating a Site Column that Looks up an External List causes error when saving site as a template.

I'm not sure what the best practice is here, but I'm having a major issue trying to save sites as templates and I think I narrowed it down as to what the issue is.

When I try to save a site as a template, it creates the solution package, but it doesn't activate it.  When I try to activate it manually, I get the following error:

Feature definition with Id e9431ed5-27b1-4c33-9eeb-81b4ace9d372 failed validation, file 'test1ListInstances\ElementsFields.xml', line 481, character 231: The 'SystemInstance' attribute is not allowed.

I opened up the solution package and looked at the ElementsFields.xml file.  I traced the line to this:

<Field Type="BusinessData" DisplayName="Acme People Name" Required="FALSE" EnforceUniqueValues="FALSE" Group="Custom Columns" ID="{55b3bbba-a7e3-4698-9946-648a6b726e9e}" SourceID="{026904fd-f2d0-4e57-a239-c6da838458fa}" StaticName="Acme_x0020_People_x0020_Name" Name="Acme_x0020_People_x0020_Name" SystemInstance="ACME" EntityNamespace="http://????????:28241" EntityName="People" BdcField="FullName" Profile="" HasActions="True" SecondaryFieldBdcNames="0" RelatedField="People_ID1" SecondaryFieldWssNames="0" RelatedFieldBDCField="" RelatedFieldWssStaticName="People_ID1" SecondaryFieldsWssStaticNames="0" AddFieldOption="AddFieldInternalNameHint" Overwrite="TRUE" />

This is my site column that is pointing to an external list.  I'm guessing SP doesn't like this.  I deleted the site column and the external list just to see if it would resolve the issue.

I get the same error, but on a different line:

<Field ID="{35d79e8b-3701-4659-9c27-c070ed3c2bfa}" Name="Overtime" StaticName="Overtime" SourceID="http://schemas.microsoft.com/sharepoint/v3/fields" Type="Text" DisplayName="Overtime" Group="_Hidden" ResultType="Number" SystemInstance="ACME" EntityNamespace="http://??????????:28241" EntityName="People" BdcField="FullName" Profile="" HasActions="True" SecondaryFieldBdcNames="0" RelatedField="People_ID" SecondaryFieldWssNames="0" RelatedFieldBDCField="" RelatedFieldWssStaticName="People_ID" SecondaryFieldsWssStaticNames="0" AddFieldOption="AddFieldInternalNameHint" Overwrite="TRUE" />

I'm not sure what's going on here.  Could this be a bug?  What's the best practice for creating an external list then creating a site column?  Should it not be done at the site collection level?

What's the fix?

Thanks in advance!

September 24th, 2010 6:35pm

I'm realizing that BSC has it's limitations.  The only way I can get this to work the way I want it to is to create a lookup at the list level.  Site collection level and site level cause the issue above.

Now, how to I resolve the above issue?  Even with all the site columns and external lists removed the elementsfield for every site template created seems to be corrupt.  Such as the Overtime field id has the BSC info.  Is there a location I can go to manually correct it?  I know I can probably edit the .wsp files, but I'd like to correct the mess I made.

Again, thanks in advance!

Free Windows Admin Tool Kit Click here and download it now
September 24th, 2010 11:33pm

Mike, did you get any further with this problem, I seem to be running into similar issues?
October 19th, 2010 3:15pm

Mike,

you probably are dealing with an XML validation error.
This is caused by an attribute ("SystemInstance" in this case) which is not allowed by the default SharePoint schema.

Try adding an extra line in the wss.xsd file located at c:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\XML

Find the following line:

<xs:complexType name="FieldDefinition" mixed="true">

and at the end of all underlying attributes and just before the line:

<xs:anyAttribute namespace="##other" processContents="lax" />

add this line:

<xs:attribute name="SystemInstance" type="xs:string" />

Perhaps you have to repeat this for any other failing attributes.....
..... and my guess would be that it's not supported by Microsoft to edit the wss.xsd schema file ......

Hope it helps ;-)

regards, Geert van Raaij

Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2010 12:55pm

Mike,

you probably are dealing with an XML validation error.
This is caused by an attribute ("SystemInstance" in this case) which is not allowed by the default SharePoint schema.

Try adding an extra line in the wss.xsd file located at c:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\XML

Find the following line:

<xs:complexType name="FieldDefinition" mixed="true">

and at the end of all underlying attributes and just before the line:

<xs:anyAttribute namespace="##other" processContents="lax" />

add this line:

<xs:attribute name="SystemInstance" type="xs:string" />

Perhaps you have to repeat this for any other failing attributes.....
..... and my guess would be that it's not supported by Microsoft to edit the wss.xsd schema file ......

Hope it helps ;-)

regards, Geert van Raaij

October 22nd, 2010 3:55pm

Hi, 

 

Any one got a solution for this issue, i'm running in the same problem?

 

Thenaks

Free Windows Admin Tool Kit Click here and download it now
April 25th, 2011 6:54pm

GvRaaij,

I am having the same issue except mine is stating: 'The BDCField attribute is not allowed.' I followed the path you indicated above, however I have no clue where to go to next. I see many files and I see, BDCMetadata and BDCMetadataResource along with many other files. Where would I go to find this?

Thank you in advance.

 

June 6th, 2011 8:26pm

Bump...

 

This seems to be a bug.  Has anyone filed a bug report of any kind?  Clearly, there is an incomplete schema which needs an update.

Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 12:50am

One of the work-a-round's that I've seen is to create the columns through PowerShell.  Here is an example:

  #Get site and web object
  $site = Get-SPSite -Identity "http://portal"
  $web = $site.RootWeb

  #Assign fieldXML variable with XML string for site column
  $fieldXML = '<Field Type="Note"
  Name="AccountId"
  Description="This is a test data column."
  DisplayName="Account Id"
  StaticName="AccountId"
  Group="Test Column"
  Hidden="FALSE"
  Required="FALSE"
  Sealed="FALSE"
  ShowInDisplayForm="TRUE"
  ShowInEditForm="TRUE"
  ShowInListSettings="TRUE"
  BdcField="Name"
  HasActions="True"
  Profile=""
  ShowInNewForm="TRUE"></Field>'

  #Create site column from XML string
  $web.Fields.AddFieldAsXml($fieldXML)

  #Assign fieldXML variable with XML string for site column
  $fieldXML = '<Field Type="BusinessData"
  Name="CRMAccount"
  Description="This is a test data column."
  DisplayName="CRM Account"
  StaticName="CRMAccount"
  Group="Test Column"
  Hidden="FALSE"
  Required="FALSE"
  Sealed="FALSE"
  ShowInDisplayForm="TRUE"
  ShowInEditForm="TRUE"
  ShowInListSettings="TRUE"
  SystemInstance="CRMSystemInstance"
  EntityNamespace="SharePoint.BDC.CRMSystem"
  EntityName="AccountEntity"
  BdcField="Name"
  HasActions="True"
  Profile=""
  RelatedField="AccountId"
  ShowInNewForm="TRUE"></Field>'

  #Create site column from XML string
  $web.Fields.AddFieldAsXml($fieldXML)

  #Dispose of Web and Site objects
  $web.Dispose()
  $site.Dispose() 


July 18th, 2011 11:02pm

Hi,

I have the same exact issue when trying to save a site as a template.

Feature definition with Id 033da7ef-71b8-4100-b4f1-04968cf0b23d failed validation, file 'testingListInstances\ElementsFields.xml', line 273, character 81: The 'BdcField' attribute is not allowed. 

"testing" is the name I gave my site template. In order to deploy and activate the solution I followed the steps here http://sharepointroot.com/2010/07/07/editing-contents-of-a-wsp-sharepoint/ to download and edit the files within the wsp using IZArc (after renaming it to cab). I removed the offending lines in the xml file, created the new cab file, saved it as a wsp, uploaded back to SharePoint and was able to activate and use the site template. It is a work around, but I still want to resolve the root cause.

I removed my site column, external list, external content type, and removed any list columns that reference the external content type, still no luck. 

Is there any PowerShell or stsadm command to clear out the reference to the 'BdcField'? Where is that reference comming from?

Thanks

Kevin
Free Windows Admin Tool Kit Click here and download it now
August 10th, 2011 9:47pm

I came up with a solution to this problem that worked for me, but it involved working directly in database, typically not supported by Microsoft.

I reviewed the file 'testingListInstances\ElementsFields.xml', line 273

<Field Type="Note" DisplayName="CW Companies_ID" BdcField="CW Companies_ID" ID="{0e0edfc0-dd5d-438d-8197-7271f73954ab}" SourceID="{02435fef-a28b-4dc7-970c-cd411194d4f5}" StaticName="CW_x0020_Companies_ID12" Name="CW_x0020_Companies_ID12" Hidden="TRUE" ReadOnly="TRUE" Overwrite="TRUE" />

and found that this information was still stored in the content database within the 'ContetTypes' table, in the 'Definition' field. I found the orphaned records that were not removed in when I deleted the site column, external list, external content type, and removed the list columns that reference the external content type. So I decided to delete these records that referenced the failing BdcFields. Once I did this I was able to create new site templates that activated without any errors.

I hope this helps anyone else having the same problem that I had.

Thank you,

Kevin

February 12th, 2012 6:04pm

I'm having this problem, too. Did anyone come up with a more kosher and/or sustainable fix?

M.

Free Windows Admin Tool Kit Click here and download it now
November 10th, 2012 4:54pm

I'm having this problem, too. Did anyone come up with a more kosher and/or sustainable fix?

January 23rd, 2013 12:32am

I tried this out and it worked for me. Needed to add the following in the schema file.

<xs:attribute name="SystemInstance" type="xs:string" />
 <xs:attribute name="EntityNamespace" type="xs:string" />
 <xs:attribute name="EntityName" type="xs:string" />
 <xs:attribute name="BdcField" type="xs:string" />
 <xs:attribute name="Profile" type="xs:string" />
 <xs:attribute name="SecondaryFieldBdcNames" type="xs:string" />
 <xs:attribute name="RelatedField" type="xs:string" />
 <xs:attribute name="RelatedFieldBDCField" type="xs:string" />
 <xs:attribute name="HasActions" type="TRUEFALSE" />
 <xs:attribute name="SecondaryFieldWssNames" type="xs:int" />
 <xs:attribute name="RelatedFieldWssStaticName" type="xs:string" />
 <xs:attribute name="SecondaryFieldsWssStaticNames" type="xs:string" />
 <xs:attribute name="AddFieldOption" type="xs:string" />

Free Windows Admin Tool Kit Click here and download it now
December 30th, 2013 5:46am

I tried this out and it worked for me. Needed to add the following in the schema file.

<xs:attribute name="SystemInstance" type="xs:string" />
 <xs:attribute name="EntityNamespace" type="xs:string" />
 <xs:attribute name="EntityName" type="xs:string" />
 <xs:attribute name="BdcField" type="xs:string" />
 <xs:attribute name="Profile" type="xs:string" />
 <xs:attribute name="SecondaryFieldBdcNames" type="xs:string" />
 <xs:attribute name="RelatedField" type="xs:string" />
 <xs:attribute name="RelatedFieldBDCField" type="xs:string" />
 <xs:attribute name="HasActions" type="TRUEFALSE" />
 <xs:attribute name="SecondaryFieldWssNames" type="xs:int" />
 <xs:attribute name="RelatedFieldWssStaticName" type="xs:string" />
 <xs:attribute name="SecondaryFieldsWssStaticNames" type="xs:string" />
 <xs:attribute name="AddFieldOption" type="xs:string" />

December 30th, 2013 10:39am

For those that need to get this fixed, the database route works. It is not very invasive, simply deleting a few orphan/erroneous records in the ContentTypes table. I know it is not ideal to hit the DB directly but if you are up against the wall, it does work. You can find the fields with this sql:

SELECT TOP 1000 [SiteId]
      ,[Class]
      ,[Scope]
      ,[ContentTypeId]
      ,[Version]
      ,[NextChildByte]
      ,[Size]
      ,[Definition]
      ,[ResourceDir]
      ,[SolutionId]
      ,[IsFromFeature]
      ,[DeleteTransactionId]
  FROM [<<YOUR CONTENT DB NAME>>].[dbo].[ContentTypes]
  where Definition like '%SystemInstance=%'

Free Windows Admin Tool Kit Click here and download it now
August 14th, 2015 11:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics