title: Using JavaScript to Show/Hide multiple fields on the same form with same id name
body: <p>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. </p>
  
  <blockquote>
    <p>function showHideSourceField() {</p>
  
  <pre><code>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);
  </code></pre>
  </blockquote>