• Michael Intravartolo

Accessing Controls within Composite Control Flyouts Using Javascript


One great new feature in Dynamics CRM 2013 is that certain fields are displayed as a composite control with a flyout to edit the individual parts of the composite field. This blog post on the Microsoft Dynamics CRM Blog gives details on how they work.

Controls within the flyout require special consideration when dealing with them in javascript. For example, imagine a scenario where address fields on some contacts are integrated with another system and shouldn't be edited in CRM. Instead of being able to write

Xrm.Page.getControl('address1_line1').setDisabled(isIntegrated);

you need to find the controlid for the address 1 line 1 field inside of the flyout. The format for these controls appears to be "CONTROLNAME_compositionLinkControl_ATTRIBUTENAME" In this case, the composite control's id is "address1_composite" so the "address1_line1" control in the flyout's id is "address1_composite_compositionLinkControl_address1_line1" so you'd need to use

Xrm.Page.getControl('address1_composite_compositionLinkControl_address1_line1').setDisabled(isIntegrated);

One easy way to access the flyout control without dealing with the cumbersome control id is to iterate through the controls of the attribute instead of going to the control directly using the id. This can also be handy when you have an attribute that is bound to several controls and you want to manipulate all of the controls for that attribute at once.

Xrm.Page.getAttribute('address1_line1').controls.forEach(function(c) { c.setDisabled(isIntegrated); });

#microsoftdynamicscrm

0 views
Contact Us

Solution Systems, Inc.

3201 Tollview Dr. 

Rolling Meadows, IL 60008

Office: 847-590-3000

Email: info@solsyst.com

Support: 224-345-2020

Support Email: support@solsyst.com

Connect With Us
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Chicago
  • Manufacturing Software | Illinois
  • Microsoft Business Podcast
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago
Join our Mailing List

© 2020 Solution Systems, Inc.