title: View source function for onChange field event in Dynamics CRM
body: <p>The onChange event for a field on my opportunity form is being called twice and I'm trying to track down the source of the second call. I've already passed the execution context into the onChange function but don't know any way to see the source of the call from there. Now I'm wondering if there's a way to see the pending events for an XRM page, does anyone know where that information is?</p>
  
  <p>My code is basically this, tied to <code>onLoad</code> of the opportunity form. There could be a plugin or 3rd party library or something updating the field, but nothing jumps out.</p>
  
  <pre><code>function onLoad() {
      Xrm.Page.data.process.addOnStageChange(handleStageChange);
  }
  
  function handleStageChange() {
      var dateFieldName = "new_enteredstage1"
      var dateFieldAttr = Xrm.Page.getAttribute(dateFieldName);
      if (dateFieldAttr) {
          dateFieldAttr.setValue(new Date());
      }
  }
  </code></pre>
  
  <p>If new_enteredstage1 is null when the stage change occurs then 2 calls occur and the value is set and immediately reset to null. If new_enteredstage1 has a value the value is updated as expected. Again, there could be some third party code that I'm missing but I have no idea how to track it down.</p>
  
  <p>UPDATE:</p>
  
  <p>This only happens on date fields, and it happens on all date fields. If I replace the code with a number field the value is not reset to null.</p>