title: How to change default form based on dropdown JS and CRM?
body: <p>Ok so what I am trying to do in CRM 2011 is to have a dropdown menu where it has two options: "Support" and "Prof. Services", this is for the Case entity. Now, I have two forms one named "Support" and one name "Prof. Services".</p>
  
  <p>What I want to happen is that if a Case has the dropdown set to "Support" when it is opened it should open with the "Support" form and if the dropdown is set to "Prof. Services" it should open with the "Prof. Services" form. </p>
  
  <p>I came across this article: <a href="http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/5ba919f7-9f7c-4abf-ba88-224951bb7c11" rel="nofollow">http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/5ba919f7-9f7c-4abf-ba88-224951bb7c11</a> and used that code in a JScript web resource. Then on both of my forms I went to the Form Properties and added an OnLoad function setForm() (as in my JS code below). But this doesn't work. The right form is not showing for the right case/dropdown value. This is the code I am using: (any help debugging this would be much appreciated) *keep in mind I am beginner JS'er :)</p>
  
  <pre><code>function setForm() {
  var currentForm= Xrm.Page.ui.formSelector.getCurrentItem().getId();                         
  var Information;
  var cType = Xrm.Page.data.entity.attributes.get('new_CaseType').getText().toLowerCase();    
  var forms = Xrm.Page.ui.formSelector.items.get();
  var i = 0;
  
  for (i = 0; i &lt; forms.length; i++) {                            
      if (forms[i].getLabel().toLowerCase()==cType) {             
          if (currentForm!=forms[i].getId()) {                    
              forms[i].navigate();
          }
          return;
      }
      if (forms[i].getLabel().toLowerCase()=='information') {     
          Information=forms[i];                                   
      }
  }
  if (currentForm!=Information.getId()) {                         
      Information.navigate();
  }
  }
  </code></pre>