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: http://blogs.msdn.com/benlec. 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:
>Url:http://ukauctioncrm/MSCRMServices/ImportXml.asmx
>MethodName:Import
>Response:
><?xml version="1.0" encoding="utf-8"?>
><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <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>
></soap:Envelope>


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: http://stunnware.com/crm2/topic.aspx?id=TraceLogViewer

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

2 comments:

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.