Tuesday, October 27, 2015

MSCRM 2015: "Updating" Composite Fields



If you’re working with many of the out of the box forms in MSCRM, you may have noticed the composite fields that nicely condense addresses and names into a more aesthetically pleasing format.


Unfortunately, there is no way to customize the fields that are displayed on the “fly out” view but there are a couple ways to get around this using JavaScript and Business Rules. 

In my example, I want users to select a country from a specific option set rather than allow them to manually type it in. I created a new country field and set up all of my options. Then I added this field to my form. The user will select the country separately from filling in the rest of the address details.

Next, we want to make sure the original country field is updated to use the selection from the option set so that the composite field shows the correct information. To do this add the following JavaScript to the on change event of the new country field.
 
function updateCountry() {
  var source = Xrm.Page.getAttribute("new_country").getText();
  Xrm.Page.getAttribute("address1_country").setValue(source);
}

Finally, to make sure that users can no longer manually type in a country, we need to hide the original country field using a business rule. In my case, I wanted to hide this field no matter what so that they could never update it on their own. This will make sure that it no longer appears on the fly out view of the composite address field.

Keep in mind that you may need to add the same changes and functionality to a quick create form if you use one. 

BEFORE:

AFTER:


2 comments:

PLC training in chennai said...

WIZTECH Automation, Anna Nagar, Chennai, has earned reputation offering the best automation training in Chennai in the field of industrial automation. Flexible timings, hands-on-experience, 100% practical. The candidates are given enhanced job oriented practical training in all major brands of PLCs (AB, Keyence, ABB, GE-FANUC, OMRON, DELTA, SIEMENS, MITSUBISHI, SCHNEIDER, and MESSUNG)

PLC training in chennai
Automation training in chennai
Best plc training in chennai
PLC SCADA training in chennai
Process automation training in chennai
Final year eee projects in chennai
VLSI training in chennai

aliya seen said...

The corporate profile writing is a best way to build profile that can attract the visitors and can god for your company.