Creating Model-Driven Apps from Tables

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 10 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Mastering Model-Driven Apps: Building from Data Tables

Introduction: The Power of Data-Centric Design

When we talk about building applications in the Microsoft Power Platform ecosystem, we often hear about two distinct paths: Canvas Apps and Model-Driven Apps. While Canvas Apps are excellent for pixel-perfect, custom-designed interfaces, Model-Driven Apps offer a fundamentally different approach. These apps are entirely metadata-driven, meaning the structure of your application—the forms, views, charts, and dashboards—is dictated by the underlying data model (the tables) in Microsoft Dataverse.

Why does this matter? In many enterprise environments, the primary goal is not to create a unique visual experience but to manage complex business processes, enforce data integrity, and ensure that users interact with information in a consistent, predictable way. By building from tables, you shift your focus from "how should this button look" to "what information does the user need to accomplish this business task." This approach significantly reduces the time required to build enterprise-grade applications because the platform handles the layout, responsive design, and navigation automatically.

In this lesson, we will explore the lifecycle of creating a Model-Driven App, starting from the data layer and moving up to the user interface. We will cover how to structure your tables effectively, how to configure the app designer, and how to refine the user experience through forms and views. By the end of this guide, you will understand how to transform raw data into a functional business tool.


Not read yet

Understanding the Foundation: Dataverse Tables

Before you can build a Model-Driven App, you must have a solid foundation in Dataverse. Dataverse is not just a database; it is a relational data platform that stores information in tables. Unlike a simple spreadsheet, these tables have built-in capabilities like relationships, business rules, and security roles that carry over automatically into your Model-Driven App.

When designing a table for a Model-Driven App, you should think about the "Entity-Relationship" model. You are not just creating a list; you are defining the objects that your business cares about—such as Customers, Orders, Projects, or Support Tickets. Each of these objects will likely become a primary table in your application.

Key Components of a Data Table

  • Columns: These define the data types (text, whole number, choice, lookup, currency, date/time) that your app will capture.
  • Relationships: These link tables together. A common example is a one-to-many relationship where one Customer has many Orders.
  • Business Rules: These are server-side logic triggers that validate data or set field values without requiring custom code.
  • Views: These are saved queries that define how a list of records appears to the user.
  • Forms: These are the screens where users create or edit individual records.

Callout: Canvas vs. Model-Driven Design While Canvas apps require you to manually place every text box, label, and gallery on a blank screen, Model-Driven apps are "opinionated." The platform dictates the structure based on the table definitions. This means if you add a new column to a table, it can be automatically added to your forms and views without you having to redesign the layout. This consistency is the primary benefit for large-scale enterprise applications.


Not read yet

Step-by-Step: Creating Your First Model-Driven App

To build a Model-Driven App, you must start in the Power Apps Maker Portal (make.powerapps.com). Follow these steps to transition from an empty environment to a functional application.

1. Creating the Table

If you haven't already defined your data, navigate to the "Tables" section in the left-hand navigation. Click "New Table" and provide a display name. Ensure you choose a plural name, as Dataverse uses this for navigation. Once the table is created, start adding columns. Avoid the temptation to add every possible field at once; focus on the fields required for the core business process first.

2. Initializing the App

Once your tables are defined, navigate to "Apps" and select "New App," choosing "Model-driven app." You will be prompted to provide a name and description. After clicking "Create," you will enter the Modern App Designer. This interface allows you to drag and drop tables into your app's navigation menu.

3. Configuring the Site Map

The Site Map defines the navigation bar on the left side of your application. You can group your tables into "Areas" and "Groups." For example, you might have an area called "Sales" and a group called "CRM" that contains your "Accounts" and "Contacts" tables. Organizing these logically is essential for user adoption, as it mirrors how your team thinks about their daily tasks.

4. Customizing Forms and Views

This is where the real work happens. Inside the App Designer, you can select specific forms and views for each table. If you don't select any, the system defaults to the "Main" form and "Active" view. However, you will almost always want to create custom views to filter out irrelevant data and custom forms to organize fields into logical tabs and sections.


Not read yet

Deep Dive: Customizing the User Experience

The effectiveness of a Model-Driven App is largely determined by how well the forms are organized. Users should not be overwhelmed by hundreds of fields on a single screen.

Designing Forms

Use the Form Designer to group related fields using sections and tabs. For instance, in a "Project" table, you might have a "General" tab for basic information and a "Financials" tab for budget and cost details.

  • Tabs: Use these to separate high-level categories of information.
  • Sections: Use these to group related fields within a tab.
  • Field Properties: Configure labels, set fields to "read-only" based on specific conditions, or make them mandatory.

Optimizing Views

Views are the primary way users interact with lists of data. A well-configured view includes:

  1. Columns: Only include the columns necessary for the user to identify the record.
  2. Filtering: Apply filters to show only relevant records (e.g., "Active Projects" vs. "Completed Projects").
  3. Sorting: Set a default sort order, such as "Created On" in descending order, to show the newest entries first.

Tip: Use Subgrids for Relationships When you have a one-to-many relationship, such as an Account having many Contacts, you should add a "Subgrid" to the Account form. This allows users to see and manage related Contacts directly from the Account screen without having to navigate away. This creates a "parent-child" experience that is intuitive and efficient.


Not read yet

Implementing Business Logic: Beyond the Interface

One of the common mistakes beginners make is trying to handle all logic in the UI. In Model-Driven apps, you have several ways to enforce data integrity.

Business Rules

Business rules allow you to implement logic without writing code. You can set field values, clear field values, validate data, and show error messages. For example, if a user selects "High Priority" in a dropdown, you can create a business rule that forces the "Due Date" field to become mandatory.

JavaScript Client-Side Scripting

While business rules cover 80% of requirements, sometimes you need more complex logic. You can use JavaScript to interact with the form's client-side API. This allows you to perform actions like filtering a lookup field based on another field's value or triggering an alert when a record is saved.

Example: Simple JavaScript validation

// This function checks if a field has a value when the form is saved
function validateForm(executionContext) {
    var formContext = executionContext.getFormContext();
    var budgetValue = formContext.getAttribute("new_budget").getValue();

    if (budgetValue < 0) {
        alert("Budget cannot be negative.");
        executionContext.getEventArgs().preventDefault(); // Stops the save
    }
}

Explanation: In this snippet, we access the form context, retrieve the value of a specific column, and perform a check. If the condition fails, we prevent the record from saving. This is a standard way to ensure data quality.


Not read yet

Best Practices for Model-Driven Development

Building an app is easy; building an app that your organization will actually use for years requires discipline.

Maintain a Clean Data Model

Avoid creating "god tables" that contain hundreds of columns. If a table is becoming too large, consider splitting it into related tables. This improves performance and makes the data easier to maintain.

Use Security Roles

Model-Driven Apps are deeply integrated with Dataverse security. Always define security roles that limit what users can see and do. A common pitfall is giving users "System Administrator" access during testing and forgetting to restrict it before moving to production. Use the principle of least privilege: give users only the access they need to perform their jobs.

Versioning and Solutions

Always develop within a Solution. Solutions are the mechanism for transporting your app, tables, and configurations between environments (e.g., Development to Test to Production). Never build directly in your production environment.

Performance Considerations

Model-Driven apps can become slow if you add too many heavy components to a single form. Avoid using too many subgrids on one form, as each subgrid triggers a separate data query. If a form is feeling sluggish, try moving some of the information to a secondary tab.


Not read yet

Common Pitfalls and How to Avoid Them

Even experienced developers fall into common traps. Being aware of these will save you hours of troubleshooting.

  • Ignoring Mobile Experience: Model-Driven apps are responsive by default, but they are not automatically optimized for mobile. Test your forms on the Power Apps mobile app to ensure the tab order and field placement make sense for a smaller screen.
  • Over-relying on Custom Code: Before writing JavaScript or building a custom plugin, check if the requirement can be met with Business Rules or Power Automate flows. Custom code is harder to maintain and upgrade.
  • Hardcoding Values: Never hardcode specific GUIDs or environment-specific values in your JavaScript or configuration. Use environment variables or configuration tables to manage settings.
  • Neglecting Documentation: Because Model-Driven apps rely on metadata, it is easy to forget why a certain field was created or why a specific business rule exists. Document your data model and logic as you build.

Warning: The "Delete" Trap Be extremely careful when deleting columns or tables in Dataverse. Once a column is deleted, the data within it is permanently removed. Always perform a backup or export your data before making structural changes to a production database.


Not read yet

Comparison: Configuration vs. Customization

Understanding the difference between configuring the platform and customizing it is vital for long-term success.

Feature Configuration (No-Code) Customization (Pro-Code)
Method App Designer, Business Rules JavaScript, Plugins, PCF Controls
Maintenance Low - handled by platform High - requires code management
Upgradeability High - automatically handled Can break during updates
Complexity Simple business logic Complex integration/logic
Skill Level Power User / Functional Consultant Developer

Advanced Feature: Power Apps Component Framework (PCF)

If the standard controls provided by Microsoft (text boxes, dropdowns, etc.) aren't enough, you can use the Power Apps Component Framework (PCF). PCF allows developers to create custom code components that behave like native controls.

For example, if you need a specialized visual representation of a data point—like a custom gauge that changes color based on a project's status—you can build a PCF control. This control is then added to the Form Designer just like any other field. This is the "pro-code" way to extend Model-Driven apps while keeping the benefits of the platform.

Steps to implement a PCF control:

  1. Develop: Use the PCF CLI to create the component structure.
  2. Package: Bundle the component into a solution file.
  3. Import: Import the solution into your Dataverse environment.
  4. Configure: In the Form Designer, select the field you want to use the control on, click "Components," and add your custom control.

Not read yet

The Role of Power Automate in Model-Driven Apps

While the Model-Driven App handles the user interface and data entry, Power Automate handles the "background work." You should view these as two sides of the same coin.

If a user updates a record in your Model-Driven App, you might need to trigger an email notification, update a record in an external system (like an ERP), or create a task in Planner. Use "Dataverse triggers" in Power Automate to listen for these changes.

Example: Triggering an email on record update

  1. Trigger: "When a row is added, modified or deleted" (Dataverse connector).
  2. Condition: Check if the "Status" column changed to "Closed."
  3. Action: "Send an email" (Office 365 Outlook connector).

This separation of concerns—the app for user interaction and the flow for background automation—is the hallmark of a well-architected Power Platform solution.


Frequently Asked Questions (FAQ)

Can I change the look and feel of a Model-Driven App?

You can apply custom themes (colors and logos) to match your corporate branding, but you cannot change the fundamental layout (e.g., you cannot move the navigation bar to the top). This is a trade-off for the rapid development speed and consistency that Model-Driven apps provide.

How do I handle large amounts of data?

Dataverse is designed to handle millions of records. The key is to use "Views" to ensure users only load the data they need at any given time. Avoid building "All Records" views that return thousands of rows, as this will impact performance.

Can I share my app with external users?

Yes, using Microsoft Entra ID (formerly Azure AD) B2B guest access, you can share your Model-Driven apps with external partners. They will need a valid license to access the app and the underlying Dataverse data.

Is it possible to use the same table in multiple apps?

Absolutely. One of the main advantages of Dataverse is that it acts as a centralized data store. You can have a "Sales App" and a "Service App" that both reference the same "Customer" table. Updates made in one app are immediately reflected in the other.


Not read yet

Key Takeaways for Success

  1. Data First: Always start by defining a clean, normalized data model in Dataverse. The quality of your application is directly tied to the quality of your table structure.
  2. Leverage the Platform: Use standard features like Business Rules, Views, and Forms before resorting to custom code. This ensures your app remains easy to maintain and upgrade.
  3. Think in Solutions: Always work within a Solution. This makes moving your app between environments simple and prevents accidental data loss during development.
  4. Prioritize Security: Implement security roles early and strictly follow the principle of least privilege. A well-secured app protects your organization's most valuable asset: its data.
  5. User-Centric Forms: Keep your forms clean and organized. Use tabs and sections to prevent "form fatigue," and use subgrids to show related information in a logical way.
  6. Test for Everything: Test your app not just as an administrator, but as a standard user. Test for mobile, test for performance, and test for edge cases in your business logic.
  7. Embrace Evolution: Model-Driven apps are not "set it and forget it." As your business requirements change, your data model and your app should evolve. Use the App Designer to make iterative improvements rather than trying to build a perfect, static tool on day one.

By following these principles, you will be able to build robust, scalable, and highly effective Model-Driven Apps that solve real-world business problems. The beauty of this approach is that you are building on top of a mature, enterprise-ready platform, allowing you to focus on logic and process rather than the minutiae of interface design. As you continue your journey with the Power Platform, remember that the most successful apps are those that simplify work for the user, not those that are the most technically complex.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.