I have to fields on the same Dynamics CRM form. One is Account Name and the other field is Company. They both share the same field id name which is parentcustomerid. I need to show/hide these fields based on the value of an option set of another field. I can get the Account name field to show/hide but the Company field will not show/hide.
function showHideSourceField() {
var type = Xrm.Page.data.entity.attributes.get("new_type").getValue(); var source = Xrm.Page.ui.controls.get("new_source"); var accountname = Xrm.Page.ui.controls.get("parentcustomerid"); var company = Xrm.Page.ui.controls.get("parentcustomerid"); //Type of Contact is Unaffiliated if (type == 100000004) { source.setVisible(true); accountname.setVisible(false); company.setVisible(false);
id
in HTML elements – Dave