Study FAQ
Which navigation, dialog or notification API should I use in a model-driven app?
Also asked as 2
- How do I choose between form notifications, alert dialogs, confirmation dialogs and record navigation?
- How can I show feedback or open the right Dataverse row from model-driven JavaScript?
Answer
Use a form notification for persistent guidance on the current form, an alert for acknowledgement, and a confirmation dialog for a deliberate user choice. Use supported navigation APIs when the user needs to inspect or create a row.
- Call
formContext.ui.setFormNotificationwith a stable identifier and clear it when the condition ends. - Use
Xrm.Navigation.openAlertDialogfor an informational result. UseopenConfirmDialogfor a decision and continue only when the returnedconfirmedvalue is true. - Use
Xrm.Navigation.openFormto open a form or quick-create form. For an existing account in a Unified Interface dialog,navigateTocan use page typeentityrecord, logical table nameaccount, the capturedentityId, and navigation target2. A missing ID makes this a create form, so validate it when the intent is inspection.
A dialog closing establishes only that it closed. Confirm the relevant business result independently and account for unsaved edits before refreshing form data. In development, check cancellation, an invalid or missing row ID, and normal-user access.
Full explanation
AB-400: Client Scripting and Commands in Model-Driven Apps
Study guide · AB-400
Read the full explanation