<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=612681139262614&amp;ev=PageView&amp;noscript=1">
Skip to content

Need help? Talk to an expert: phone(904) 638-5743

Customizing Model-Driven App Command Bar with Power FX Using the Command Designer 💡

Customizing Model-Driven App Command Bar with Power FX Using the Command Designer 💡

In this video, Brian Knight from Pragmatic Works demonstrates how to enhance model-driven applications by customizing the command bar using Power Fx. This approach bridges the gap between canvas and model-driven apps, allowing developers to introduce custom buttons and automate processes directly within their applications.


Understanding the Evolution of Model-Driven Apps

Brian explains that the distinction between canvas apps and model-driven apps has been gradually diminishing. With features like custom pages and now Power Fx-enabled command bar customization, developers can leverage canvas-like capabilities within model-driven environments.

Scenario Overview: Loan Payment Schedule Automation

To demonstrate the functionality, Brian builds a simple loan management app. The goal is to generate a payment schedule based on loan details such as:

  • Loan amount
  • Start date
  • Payment duration (e.g., 12 months)

By clicking a custom button, users can automatically generate a full payment schedule.

Step 1: Editing the Command Bar

Brian begins by navigating to the solution and selecting the appropriate table. He then chooses to edit the command bar for the main form. This allows developers to:

  • Add new buttons
  • Customize existing commands
  • Select between JavaScript or Power Fx logic

He emphasizes selecting Power Fx to enable low-code customization.

Step 2: Creating a Custom Button

A new button labeled "Create Payment Schedule" is added. Developers can:

  • Assign custom icons
  • Control visibility using formulas
  • Define actions using Power Fx

This button becomes the trigger for generating loan payment records.

Step 3: Connecting Data Sources

Brian highlights the importance of connecting relevant tables inside the command library. In this case:

  • Main Loan table
  • Loan Payments table

This ensures the button can interact with multiple data sources.

Step 4: Writing Power Fx Logic

The core functionality is implemented using Power Fx. Brian outlines the logic in structured steps:

  1. Remove Existing Records
    • Uses the RemoveIf function
    • Deletes existing payment schedules for the selected loan
  2. Loop Through Payment Terms
    • Uses ForAll with Sequence
    • Iterates based on the number of payment terms
  3. Create New Records
    • Uses the Patch function
    • Inserts new payment records into the Loan Payments table
  4. Calculate Payment Dates
    • Uses DateAdd
    • Automatically increments the payment date per iteration
  5. Provide User Feedback
    • Uses Notify to confirm schedule creation

Step 5: Publishing and Testing

After implementing the logic, Brian stresses the importance of:

  • Saving and publishing changes
  • Using "Publish All Customizations" if updates do not reflect
  • Refreshing the browser to load the latest version

Common Challenges and Tips

Brian shares several practical insights:

  • Some Power Fx functions may not yet be supported in command bars
  • Publishing issues may require manual intervention
  • Testing with small changes (like adding symbols) helps confirm updates

Final Output

Once completed, clicking the custom button generates a full payment schedule:

  • Sequence numbers (1 to 12)
  • Consistent payment amounts
  • Monthly payment dates starting after the loan start date

Conclusion

Brian concludes that Power Fx integration into command bars significantly enhances the flexibility of model-driven apps. Developers can now build powerful, low-code solutions that automate business processes and improve user experience.

This feature opens the door to more advanced customizations, making it easier to extend functionality without relying heavily on traditional coding methods.

 Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Fx 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.  

Sign-up now and get instant access

Leave a comment

Free Community Plan

On-demand learning

Most Recent

private training

Hackathons, enterprise training, virtual monitoring