PL-400 practice question 12 of 35
You need to add the script to populate event data on the form. Which code segment should you use?
Full set: 391 questionsDomain Create and configure Power Apps
The formContext.data.addOnLoad method is the correct client API function to register a script that executes when a model-driven app form finishes loading. This event is the appropriate trigger for populating or manipulating data as the form is initially presented to the user. The method adds a specified function, in this case myFunction, to the OnLoad event handler pipeline for the form.
B. formContext.data.removeOnLoad(myFunction): This method removes a function from the OnLoad event handler, which is the opposite of the required action.
C. formContext.data.entity.addOnSave(myFunction): This method registers a function to run during the OnSave event, which occurs when the user tries to save the record, not when the form loads.
D. addOnPreProcessStatusChange: This method is part of the business process flow object (formContext.data.process) and is used for events related to BPF stage changes, not the main form load event.
E. formContext.data.isValid(): This is a method that returns a boolean value indicating if the form data is valid. It does not register an event handler to run code. ---
1. Microsoft Learn Documentation: formContext.data.addOnLoad. This document explicitly states, "Adds a function to be called when the form is loaded." This directly supports the use of this method for running scripts on form load.
Source: Microsoft, "Client API formContext.data object," Microsoft Learn, formContext.data.addOnLoad section.
2. Microsoft Learn Documentation: Events in model-driven apps. This page describes the form event pipeline, identifying OnLoad as the event that occurs when the form has loaded. It contrasts this with the OnSave event.
Source: Microsoft, "Events in model-driven apps," Microsoft Learn, "Form events" section.
3. Microsoft Learn Documentation: formContext.data.entity object. This document details the addOnSave method, confirming it is used for the save event, making it unsuitable for a form load scenario.
Source: Microsoft, "Client API formContext.data.entity object," Microsoft Learn, addOnSave section.
Keep practicing
Take the free PL-400 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PL-400 practice questions
- Question 4You are designing a one-way integration from Microsoft Dataverse to another system. You m…
- Question 6You need to configure the trigger for account records. Which expression should you use?
- Question 8You are building a custom application in Azure to process resumes for the HR department. …
- Question 14A company plans to create an order processing app. When orders are created, the app will …
- Question 15You are creating a model-driven app. You create JavaScript code to display a message when…
- Question 16You need to identify the Azure service to use for the Planning Hub application. Which ser…
