The element ‘form’ has invalid child element ‘events’
While sandboxing the upgrade of one of our CRM 3.0 customers to v4.0, I ran into an issue while customizing one particular entity.
Here are the steps I normally take in this process:
- Redeploy the customer’s PROD CRM 3.0 databases in my sandbox VM using the ‘old’ stack of software (Win 2003, SQL 2005)
- In-place upgrade to CRM 4.0, apply RU patches
- Clean up the navigation UI
- Import those newly upgraded databases into a new CRM 4.0 sandbox built on the ‘new’ stack (Win 2008, SQL 2008)
But I hit a snag in Step 3 while trying to import a v4 schema file that I had exported just moments earlier. Using the CRM Platform Trace, I narrowed it down to the email entity. The error in the trace log was:
ValidateImportDocument hit exception. Message: The element ‘form’ has invalid child element ‘events’
I’d never seen this one before and Google wasn’t much help. From the message I gathered it had something to do with the Form – likely some problem with either the onload() or onsave() events. But even after I got rid of the event javascript altoghter, the issue persisted.
Then i happened to notice out of the corner of my eye the word ‘event’ was also found on the ‘Non-Event Dependencies’ tab. Having a look I noticed that there actually were some Dependent fields listed:
I think this was perhaps done by the customer in an effort to ensure some fields were never removed from the form, but there are better ways to handle that. Taking a peek at the customization XML for this entity, I could see an <externaldependencies> section in the form xml:
I actually tried removing these dependencies one-by-one, thinking that maybe there was just one offending item – but in the end I had to get rid of all of them AND get rid of the <externaldependencies> start/end tags altogether!
Once done, I was able to re-import the XML and life was good again. I wasn’t quite happy with the goofiness of this, so I decided to, in v4, add those 5 fields back as dependencies through the UI and then export the XML again. I figured maybe there was a new syntax or format to the XML and that was causing the XML format issue.
But what I saw was that the <externaldependencies> section was identical to my original XML. Huh?
So I put the original and the new up side-by-side and spotted one innocuous difference – can you spot it?
Original:
New:
The only difference was the order in which the <externaldependencies> section and the <events> section appear in the XML.
So, I edited my original XML and put the <externaldependencies> section after the <events> section. and what do you know – the issue disappeared.
So don’t ask me why, but apparently the order of those sections is important in V4 – but the v3-to-v4 upgrade did not re-order the form XML correctly.
Hope this helps some poor sod down the road.
Make A Comment: ( 1 so far )
One Response to “The element ‘form’ has invalid child element ‘events’”
software development london
January 15th, 2010



Nice post,
great code help,
Thanks for bringing this up