Thursday, January 19, 2012

IFRAME not showing up on CRM 2011 form


So today I was tasked with removing required fields off a CRM form that also has an IFRAME and some ScriptableMember logic to tie the ribbon to the silverlight within the IFRAME.

To remove the section with the required field is simple enough. First you need to export an unmanaged solution and open up the customizations.xml. Locate the section node and remove as needed. Import back in and viola. Remember to keep a copy of your export file in case something goes wrong.

So once I got every field off the form except for the IFRAME, I saw that the IFRAME wasn't showing up. I checked the DOM and it did exist but the visibility was set to false. This seemed odd since all the checkboxes associated with the IFRAME and section were set to true.

I decided to try to add to the footer, modified by and when, but that didn't work either.

I also tried adding another IFRAME to no avail.

The solution lies in using the xrm elements in javascript. I'll post the javascript now but please keep reading because yet another bug came to light after this....

//the 0 will correspond with whatever tab you are working with....
Xrm.Page.ui.tabs.get(0).setVisible(true);


So this successfully shows the IFRAME with no other controls on the form. But once I did this I found out that the ribbon no longer functioned. After pulling all my hair out I ended up adding a crm created field in the same tab in a new section underneath and set that to invisible as well as its label. Once I did that everything worked flawlessly.

Happy Coding!