Summary

As a Customer Engineer with Microsoft, I have seen many ways in which Customers and ISVs are being alerted to the fact that they have potential performance issues caused by synchronous (sync) XMLHttpRequest (XHR) in their Dynamics 365 CE (D365CE) custom JavaScript code. The goal here is to demonstrate an asynchronous (async) code pattern to replace these sync XHR calls. That will still have the UI wait on the response and provide better client-side performance.

Through this blog we will demonstrate a solution using modern browsers that support ES6 and a JavaScript pattern using Async Await keywords. This includes some new platform functionality that has been added to onload, onsave and ribbon events on D365CE form events.

History

There are a several reasons sync XHR calls are being highlighted for replacement with async calls.

  1. Modern browsers have deprecated the use of sync XHR calls.
  2. Sync XHR calls have a significant potential to cause performance issues.
  3. Sync XHR calls are especially problematic for users in high latency or poor network environments and are not typically discovered by developers because they are not testing in such conditions.

Let’s look at some patterns we want to avoid or replace. Please follow this link for the rest of the story.