Importing Customizations: Invalid Attribute

Here's an approach for finding a solution to a new error which I haven't discussed before. The error that I will discuss is the message "Invalid Attribute" while importing the customizations. This only appears when there are already customizations imported and you try to import a new version of the customizations file.

I wasn't able to find out information on Google or Partner Source, but managed to find out what was going wrong. The way I found this out, is by using the CRMDiagTurbo tool. You can find this tool on the blog of Benjamin Lecoq: This tool allows you to do quite some things of which one is to easily enable the tracing for CRM. The way to find the error is to start tracing, perform the import, wait for the error, stop the tracing. You now can go and search in the file c:\CrmDiagPlatformTrace[ddMMyyyy]\w3wp-MSCRMServices-[yyyyMMddhh].log for the string "SOAP Request failed".

This will show you an entry which says:

>SOAP Request failed:
><?xml version="1.0" encoding="utf-8"?>
><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
> <soap:Body>
> <soap:Fault>
> <faultcode>soap:Server</faultcode>
> <faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Microsoft.Crm.CrmArgumentOutOfRangeException: MaxLength is out of range for 'new_footertext' field. MaxLength: 5000, StringMinLength: 1, StringMaxLength: 4000 ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
>Parameter name: MaxLength is out of range for 'new_footertext' field. MaxLength: 5000, StringMinLength: 1, StringMaxLength: 4000
> --- End of inner exception stack trace ---
> at Microsoft.Crm.Metadata.StringAttributeUIData..ctor(AttributeMetadata metadata, XmlNode xmlProperties)
> at Microsoft.Crm.Metadata.AttributeMetadata.CreateUIData(XmlNode propertiesXml, Organization settings)
> at Microsoft.Crm.Metadata.EntityMetadata.InsertFieldXml(XmlDocument entityXml, Boolean ignoreFieldXmlErrors, Organization settings)
> at Microsoft.Crm.Metadata.EntityMetadata.InsertEntityXml(DataRow reader, Boolean ignoreFieldXmlErrors, Organization settings)
> at Microsoft.Crm.Metadata.DynamicMetadataCache.LoadUIInfo(DataTable OrganizationUI)
> at Microsoft.Crm.Metadata.DynamicMetadataCache.LoadCache(DataSet ds)
> at Microsoft.Crm.Metadata.DynamicMetadataCache.Flush()
> at Microsoft.Crm.Tools.ImportExportPublish.ImportEntityRelationshipHandler.ImportItem()
> at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
> at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities, ImportMask Mask)
> at Microsoft.Crm.Tools.ImportExportPublish.ImportXml.RunImport(String parameterXml)
> at Microsoft.Crm.WebServices.ImportXmlWebService.Import(String parameterXml, String customizationXml)
> --- End of inner exception stack trace ---</faultstring>
> <detail />
> </soap:Fault>
> </soap:Body>

When looking to the faultstring in this soap package, we can see that the new_footertext is causing the problem. Apparently this attribute has been removed in the development environment and been added again with a larger length than the original length. To solve this particular error I have just removed the field from the target system and reimported the customizations file, but since the exact message will differ in your system, you will need to find out what you will do with the attribute specified.

Since the trace file is quite hard to understand if you are seeing this for the first time, you can also use the CRM Trace Log Viewer. This is a tool created by Stunnware (Michael Höhne) which you can download here:

I hope this helps somebody who encounters the same error message.


b1ur said...

Thanks, I find your post helpful!

Anonymous said...

Thanks for the info - I'll have a look at the tool you suggest. In the past I have found that running SQL Profiler during an import that fails will also give an indication of where the issue lies as you can see the last SQL statement before the transaction rolls back.