title: Javascript Function Not Trigger in crm 2011 on change event
body: <p>Scenario:</p>
  
  <p><strong>Step 1:</strong> Am using MS CRM 2011.I write the javascript Function For Get the To Field Value(Email Entity) and set that Value into Regarding Field.It was Working Fine.</p>
  
  <p><strong>Step 2:</strong> Write the Process for Update the value in Regarding Field as clear.Because automatically the regarding Field Get some Value.So I need to change that as empty in Regarding field.It was  Working  fine.</p>
  
  <p><strong>Step 3:</strong> now I call the the javascript Function in onchange Event.</p>
  
  <p><strong>Problem:</strong> The Regarding Field value Get clear after the process Execute.which means the old value replace and new value get in the Regarding Field.It is Like a on change Event.The old value replaced as a Empty.</p>
  
  <p>But the Function not trigger.If open the email form and change the regarding Field,It was working Fine which means the Javascript can work.</p>
  
  <p><strong>summary:</strong> The onchange event didnt not call when I change the value from Process.But I trying manually the javascript working Fine.</p>
  
  <p>How to solve this problem.</p>
  
  <p>**Refer the Following Screen Shots:</p>
  
  <p>Using this Java Script:</p>
  
  <p><strong>Step 1 Coding</strong>
  function TofieldValuetoOtherField()
  {</p>
  
  <pre><code>var lookup = new Array();
  lookup = Xrm.Page.getAttribute("to").getValue();
  if (lookup != null) 
  {
  
      var name = lookup[0].name;
      var id = lookup[0].id;
      var entityType = lookup[0].entityType;
      Xrm.Page.getAttribute("regardingobjectid").setValue([{ id: id, name: name, entityType: entityType }]);
       //Xrm.Page.data.entity.save();          
  
     }}
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/o2Ycj.png" alt="enter image description here"></p>
  
  <p><strong>Call the Onchange like this Its not Fired.</strong></p>
  
  <p><img src="https://i.stack.imgur.com/P0RmS.png" alt="enter image description here"></p>