title: Dynamics CRM 4.0 J Script - 'If' statement using statecode
body: <p>I am trying to create a simple alert as an <code>onload</code> event on the contact entity. However, I only want this to trigger if one of the conditions is that the contact is still active.</p>
  <p>I therefore put it the following:</p>
  <pre><code>if (crmForm.all.statecode.DataValue == 0)    
  {    
  alert(&quot;'Whatever alert I want&quot;) ;    
  }
  </code></pre>
  <p>However, when I load the contact record it errors. Is it not possible to base an 'if' statement on the status.</p>