Wednesday, January 11, 2012

CRM 2011 Form XML

Retrieving and parsing the Form XML in CRM 2011 is pretty easy.  If you ever had to do this in CRM 4.0 you would know that the Form XML was stored in the OrganizationUI table.  In CRM 2011 it is now stored in the SystemForm table.  

So first things first, we need to build a query to retrieve the Form XML for an entity from the SystemForm table.

In my case, I just have the entity's name so I need to retrieve the entity metadata and find it's type code to use to filter the query.  I also filter the SystemForm Type by 2 which means it is the Main form (

Now that we have my entity's Form XML.  We can build a method to find all the attributes' schema names that exist on the form.  This method just parses the XML string into an XElement and then selects all the id's of the "control" nodes that exist in the Form XML.  This array of id's will be all the schema names of the attributes that exist on the form.

We can do something similar to get all the id's of the Left Navigation items and all the names of the tabs and sections that exist on the form.

Other elements of the form that can be useful and stored in the Form XML are:
  • Header
  • Footer
  • Form Parameters
  • Form Libraries
  • Client Resources
  • Events
Happy Parsing!

1 comment:

  1. Thanks for your post! How can we retrieve FormXML using JavaScript?