Wednesday 24 January 2018

Hide/Show Field based on Option Set in Dynamic CRM using JavaScript

Hide/Show Field based on Option Set in Dynamic CRM using JavaScript

Description:

In this example we explain that how to show/hide Field based on Option Set Value in Dynamic CRM using JavaScript. Or how to show or hide Fields or control based on Option Set change value in Dynamic CRM using JavaScript. Or how to hide field based on Option Set Field in Dynamic CRM using JavaScript. Or how to show hide a tab based on Option Set Value in Dynamic CRM using JavaScript.

Here we demonstrate that hide or show controls based on the option set value and configured those function in then on change event of option set field.
JavaScript:

function  ShowHideLookupByContactType() {
var sectioncontacttypeValue = Xrm.Page.data.entity.attributes.get("new_contacttype").getValue();

if(sectioncontacttypeValue == 1) // Company

{

Xrm.Page.ui.controls.get("parentcustomerid").setVisible(true);
}
else if(sectioncontacttypeValue == 2) //Lead

{

Xrm.Page.ui.controls.get("parentcustomerid").setVisible(false);
}
}


0 comments:

Post a Comment