What's changed: Created PL-400 Chapter 2 (domains: Power Apps improvements + Extend UX): advanced canvas apps (complex Power Fx, component libraries, cloud flows from canvas, delegation/delegation warnings, pre-loading, Monitor), client scripting (Client API object model formContext/executionContext, OnLoad/OnChange/OnSave, Dataverse Web API, commands/buttons, navigateTo), and PCF code components (init/updateView/getOutputs/destroy, manifest, interfaces, package/deploy/consume, Device/Utility/Web API).
2.2Client scripting
Understand the JavaScript Client API object model, event handler registration, calling the Dataverse Web API from the client, commands/buttons, and navigation to custom pages.
Client scripting extends model-driven forms with code. The key is using the Client API object model correctly.
2.2.1Client API object model and events
The JavaScript Client API object model manipulates forms via formContext (access to form/attributes/controls) and executionContext (event info). Bind scripts via event handler registration to OnLoad/OnSave/OnChange, etc. OnLoad fires on form load, OnChange on field change, OnSave on save—different timings.
2.2.2Dataverse Web API and commands
To read/write Dataverse data from the client, call the Dataverse Web API (Xrm.WebApi). Configure ribbon commands and buttons with Power Fx or JavaScript for behavior and visibility. Use the Client API (Xrm.Navigation/navigateTo) to navigate to custom pages for rich UX. Unlike server-side execution (plug-in), these are client-side extensions.
Cues: "manipulate form/attributes/controls" = formContext. "event info" = executionContext. "on load/change/save" = OnLoad/OnChange/OnSave. "read/write Dataverse from client" = Dataverse Web API (Xrm.WebApi). "navigate to a custom page" = Client API navigateTo. Client extension = client scripting; server = plug-in.
Watch the mix-ups: (1) Client scripting (client/UX) vs plug-in (server/Dataverse events). (2) formContext (form ops) vs executionContext (event info). (3) Distinguish OnLoad/OnChange/OnSave timing. (4) Client API (client Web API calls) vs server Organization service.
2.2.3Section summary
- Client API object model = formContext/executionContext; register on OnLoad/OnChange/OnSave
- Read/write Dataverse from the client via the Dataverse Web API (Xrm.WebApi)
- Commands/buttons via Power Fx+JS; navigateTo for custom pages
Sign in to track progress — Log in.
Quick check
(just a quick review)Q1. In a model-driven form, which object accesses attributes/controls to set values and control display?
Q2. You want a script to run when a field value changes. Which event to register?
Q3. From client script, you want to read/write Dataverse records. Best API?
Q4. On selecting a ribbon button, you want to navigate to a custom page. Best means?
Q5. Which correctly distinguishes client scripting from a plug-in?

