In this tutorial, Nate Halliwell from Pragmatic Works demonstrates how to create a modal pop-up in a Model-Driven App using the Confirm function in Power FX—completely avoiding JavaScript. This makes the process more accessible for Power Platform users and introduces a simple way to prevent unintended bulk actions within your app.
Nate uses an asset management model-driven app, where users can view a list of assets and their associated asset items. The challenge he faces is preventing users from accidentally performing irreversible bulk operations—specifically, decommissioning all associated asset items with a single click.
Although this action works, users are not informed of the consequences or results, leading to possible errors. Nate walks us through creating a confirmation pop-up using Power FX’s Confirm function to solve this problem.
Confirm function inside an If statement to trigger a true/false response based on user interaction.The Confirm function in model-driven apps (not available in canvas apps) returns a Boolean value based on whether the user clicks the confirm or cancel button.
Syntax Overview:
If(
Confirm("This procedure will mark all associated items as unavailable.",
{
Title: "Wait",
Subtitle: "Please confirm this action",
ConfirmButtonText: "OK",
CancelButtonText: "Cancel"
}
),
// TRUE: User clicked confirm
Notify("All associated items marked as unavailable.", NotificationType.Success, 2500),
// FALSE: User clicked cancel
Notify("Operation cancelled.", NotificationType.Information, 2500)
)
Confirm function is a powerful way to prompt users before performing important operations in a model-driven app.By following Nate Halliwell’s step-by-step guide, Power Platform users can implement pop-up confirmations without needing JavaScript. This is a game-changer for anyone looking to streamline user experiences while safeguarding critical operations.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Model Driven and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.