nerdexam
Microsoft

PL-400 · Question #458

A model-driven app form has JavaScript that runs during the OnLoad event. The event retrieves an account record and changes visibility to a form column based on one of the record columns. The…

The correct answer is C. Enable the Async OnLoad app setting. Your model-driven app form loads slowly because the default OnLoad event is synchronous, meaning it blocks form rendering while waiting for Xrm.WebApi.retrieveRecord to complete, but enabling the Async OnLoad setting makes these handlers asynchronous, allowing the form to load…

Submitted by thandi_sa· Apr 18, 2026

Question

A model-driven app form has JavaScript that runs during the OnLoad event. The event retrieves an account record and changes visibility to a form column based on one of the record columns. The following portion of code retrieves the account record: Xrm.WebApi.retrieveRecord('account', accountId)_ Users report that the form loads slowly. You need to improve the performance of the code that retrieves the account and changes visibility. What should you do?

Options

  • AUse a synchronous XMLHttpRequest instead.
  • BAdd the code to change visibility to the success callback.
  • CEnable the Async OnLoad app setting.
  • DSet the options parameter to return only the column required.
  • EStore the returned data in a global variable.

How the community answered

(44 responses)
  • A
    2% (1)
  • B
    2% (1)
  • C
    77% (34)
  • D
    11% (5)
  • E
    7% (3)

Explanation

Your model-driven app form loads slowly because the default OnLoad event is synchronous, meaning it blocks form rendering while waiting for Xrm.WebApi.retrieveRecord to complete, but enabling the Async OnLoad setting makes these handlers asynchronous, allowing the form to load first and the JavaScript to run in the background, significantly improving perceived performance. To fix this, enable Async OnLoad in your app's settings and refactor your JavaScript to use modern async patterns (like async/await) with Xrm.WebApi calls, as synchronous Web API calls are discouraged for performance. Using a synchronous XMLHttpRequest in a model-driven app's OnLoad event does make the form load faster initially because it blocks rendering until data arrives, but it's a bad practice that freezes the UI, leading to poor user experience and potential timeouts. https://learn.microsoft.com/en-us/power-apps/developer/model-driven- apps/clientapi/reference/events/form-onload

Community Discussion

No community discussion yet for this question.

Full PL-400 Practice