title: CRM 365 - Blocking the "onSave" operation when validations require FetchXMLQueries be executed
body: <p>The CRM365 forms provide the &quot;OnSave&quot;  event to be able to perform business validations.
  If one of the validations fails, we can use the &quot;executionContext.getEventArgs().preventDefault()&quot; to stop the record creation.
  It is all good vor validating the fields of the current form, however, there are situations when the validations must also require executing a query against the entity records.
  For example, creating a reservation of a room must check if there is any other pre-existing reservation and stop if they overlap.
  The problem is that the REST API call is an asynch and needs time to execute and return results. By the time the information becomes available in the Response, the &quot;OnSave&quot; function is way ended and the record saved basically without validation.</p>
  <p>My questions are as follows:</p>
  <ol>
  <li><p>Is any reverse of the &quot;executionContext.getEventArgs().preventDefault()&quot;? We can stop the save operation but is any &quot;allow save&quot; sort of speak?
  I have tried to the &quot;formContext.data.entity.save();&quot; but since I am in the &quot;OnSave&quot; event it created an infinite loop. It is almost unthinkable to me that this flag can be set but not reset.</p>
  </li>
  <li><p>Is any effective to stop the Javascript or make it &quot;sleep&quot; until the REST API data becomes available? everything revolves around SetTimeout function but that is a non-blocking function and my javascript just runs through it, of course.</p>
  </li>
  </ol>
  <p>I am sure I am not the only running into this situation, it must be pattern to solve these REST API based validations.</p>
  <p>I should be probably add that I am looking for a client side based solution; all these could be relatively easy to implement in a plugin or custom workflow.</p>
  <p>Thank you for your time and help.</p>