Pragmatic Works Nerd News

Enhance Model-Driven Apps with PowerFX: Creating Pop-Up Confirmations

Written by Nate Halliwell | Jan 02, 2024

Creating a modal pop-up in a model-driven app without using JavaScript has become simpler thanks to PowerFX. Nate Halliwell's latest YouTube video guides viewers through this process. This post summarizes their tutorial, focusing on enhancing a model-driven app's functionality with the 'Confirm' PowerFX function.

 

Simplifying Asset Management in Model-Driven Apps

The video starts with a familiar scenario in asset management, showcasing a model-driven app. The app lists assets and asset items, leveraging the new Power Apps grid control. Although functional, the app lacks user notifications when decommissioning child items from assets.

The Challenge: Adding Confirmation Without JavaScript

The key challenge addressed is adding a confirmation pop-up when decommissioning items. Traditionally, this required custom JavaScript, but PowerFX offers a streamlined solution.

Step-by-Step Guide to Implementing the Confirm Function

  1. Accessing the Command Bar: The first step involves navigating to the command bar in the model-driven app's designer interface.

  2. Editing the Main Grid Command Bar: Focus on the main grid's command bar, where the custom 'Decommission Items' button is located.

  3. Utilizing the Component Library: For a more familiar design experience, especially for those with a canvas app background, the tutorial suggests using the component library.

  4. Incorporating Alternate Data Sources: The necessity of bringing in alternate data sources like asset items is highlighted.

  5. Writing the PowerFX Formula: The crux of the solution is writing a PowerFX formula that utilizes the 'Confirm' function within an 'if' statement.

    • Creating the Confirm Function: The 'Confirm' function requires parameters like the text for the pop-up, title, subtitle, and labels for the confirm and cancel buttons.
    • Result Handling: The function outputs a boolean value, triggering different actions based on user selection (confirm or cancel).
  6. Testing and Deploying: After saving and publishing the changes, the video demonstrates testing the new feature in play mode.

Exploring the PowerFX Formula

The video concludes with a detailed walkthrough of the PowerFX formula, emphasizing its similarity to the 'Notify' function in Power Apps. Key points include:

  • Specifying the Confirmation Message: Clearly define what the procedure entails.
  • Handling User Responses: Implement actions based on the true/false outcome of the 'Confirm' function.
  • Implementing Notifications: Use notifications to inform users about the success or cancellation of the operation.

Conclusion

The tutorial ends by encouraging viewers to try adding confirmation pop-ups to their model-driven apps. The process is straightforward, requiring no JavaScript and only a basic understanding of PowerFX.

Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Azure and other Microsoft applications.

Be sure to like and subscribe to our YouTube channel to stay updated on the latest Power Apps tips and tricks.