Composite Controls – Features and Customization in Dynamics CRM

MS CRM 2013 came in with new features which changed the usability, design and customization options within CRM. In this post, we will be looking at Composite Controls, a new feature in MS CRM 2013. We shall detail how to customize the flyout items of the control in MSCRM 2015.

Composite field is a new feature of MS CRM 2013, which combines multiple field values into a single field on the CRM form. There are two predefined composite attributes which are available in CRM, but further custom composite controls cannot be created in CRM. The two composite attributes that are available in CRM for use are listed below:

  • Fullname which combines the field values of first name, middle name and last name
  • Address which combine the field values of street, state, country and postal code

These fields are available in the contact, lead, user, account, quote, order and invoice entities.

For more information on composite attributes, please click here

A sample composite field in contact entity is shown in the figure below.

Customization of the Flyout Items of Composite Field

Although custom composite controls cannot be created in CRM, certain customizations of the flyout menu in the composite control are possible using javascript and business rules.

For instance, setting the value in the flyout item can be done using javascript as well as through business rules, but it is needed to save it manually by clicking on done button in the flyout menu for the changes to get reflected in the composite control field. Also getting the value of the item and setting the requirement level can be done using the same syntax as used for the normal fields in the CRM form.

Xrm.Page.getAttribute(“fieldname”).setValue(“value”);

Xrm.Page.getAttribute(“fieldname”).setRequiredLevel(“requirementlevel”);

This article throws more light on setting the visibility of the flyout items.

Set Visibility of the Flyout Items

If there is a need to hide one of the flyout items of the composite control field, then it can be performed either by using javascript or by using business rules.

  • Using Javascript

This task can be performed using the syntax

document.getElementById(“compositefiledname_compositionLinkControl_flyoutitemname_d”).parentElement.style.display = “none”;

This usage of javascript is in an unsupported manner, and hence unsecure. Hence, this method is not preferred.

  • Using Business Rule

Using business rules, the visibility can be set in a supported and secure manner. The detailed procedure for achieving this functionality is given below.

Step 1:  Open the entity form and click on the Business Rules tab in the ribbon and click on the New Business Rule button in the right bottom of the form as highlighted.

Step 2: Without specifying any conditions, just set visibility of the flyout item to none in the business rule. Now, Save and Activate it.

Since no condition is specified, this will work on load of the record in CRM and the field in the flyout will be hidden.

Step 3: Once the rule has been activated, reload the form to find the changes in the composite control.

Now it can be noted from the composite control that, the field “Street 3” in the flyout menu is hidden from the form and the visibility change has been accomplished by using business rule in a secure manner.
Disclaimer: All images have been sourced from our inhouse Dynamics CRM online trial subscription.

The following two tabs change content below.
Sandhiya K

Sandhiya K

A Microsoft Dynamics 365 developer with unfading desire for learning… “Learning Never Ends” is what she believes in…
Sandhiya K
Sandhiya K

A Microsoft Dynamics 365 developer with unfading desire for learning… “Learning Never Ends” is what she believes in…

All stories by: Sandhiya K