title: CRM 2013: Force refresh a form after save
body: <p>We have a requirement to refresh the form after saving (to ensure that some hide/show logic works as expected based on a field value). </p>
  
  <p>Currently the form does not automatically refresh after saving the record. </p>
  
  <p>I have gone through some articles and found this reference: 
  <a href="http://msdn.microsoft.com/en-us/library/dn481607%28v=crm.6%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dn481607%28v=crm.6%29.aspx</a></p>
  
  <p>When I try to do either of the below, it results in an infinite loop and throws a 'Callstack exceeded Max limit' error. </p>
  
  <ol>
  <li><pre><code>OnSave(context)
  {
    //my logic 
    ...
    ...
  
    Xrm.Page.data.save.then(SuccessOnSave, ErrorOnSave);
  }
  
    function SuccessOnSave()
   {
    //force refresh
     Xrm.Page.data.refresh();
   }
    function ErrorOnSave()
    {
      //do nothing
    }
  </code></pre></li>
  <li><pre><code>  OnSave(context)
   {
     ...
    ...
    //force refresh
    Xrm.Page.data.refresh(true).then(SuccessOnSave, ErrorOnSave);
  }
  
    function SuccessOnSave()
   {
    //do nothing
   }
    function ErrorOnSave()
    {
      //do nothing
    }
  </code></pre></li>
  </ol>
  
  <p>Can someone please explain me how to use the refresh or save method to do a force refresh of the form ?? </p>
  
  <p>Rajesh</p>