Introduction
Model-driven apps, part of Microsoft Power Platform, offer a powerful way to build sophisticated, data-driven business applications without writing extensive code. Unlike canvas apps that start with the user interface, model-driven apps begin with data modeling and leverage the robust capabilities of Microsoft Dataverse.
What makes model-driven apps appealing is their rich UI generation based on the underlying data structure, security, and business rules. But to truly tailor them to business needs, customization is essential.
This article explores best practices and techniques for customizing model-driven apps, including UI personalization, business logic, security roles, and extension using tools like Power Automate and JavaScript.
What Is a Model-driven App?
A model-driven app is a type of app in the Power Platform that automatically generates a responsive user interface based on the schema and relationships of data entities (tables) in Dataverse.
Key Benefits:
- Responsive and consistent UI
- Component reusability
- Security model integration
- Out-of-the-box business logic support
- Low-code customization
Components of a Model-driven App
Understanding what can be customized starts with understanding the building blocks:
- Tables (Entities)
- Forms
- Views
- Dashboards
- Business Process Flows
- Site Map
- Security Roles
- Business Rules
Customization Areas
1. Data Modeling (Tables, Columns, Relationships)
Start by defining the tables (formerly called entities) that represent your data.
Best Practices:
- Use custom tables (
new_
prefix) instead of modifying system tables. - Define relationships (1:N, N:N) to connect tables logically.
- Use choice columns for predefined values.
- Enable auditing on critical tables and columns for compliance tracking.
2. Forms Customization
Forms control how users interact with individual records.
Key Customizations:
- Tabs and Sections: Organize data logically.
- Business Rules: Apply logic without code (e.g., show/hide fields).
- JavaScript Events: Use JavaScript for advanced logic on load, change, or save.
- Custom Controls: Enhance user experience with sliders, toggles, or maps.
Best Practices:
- Use Main forms for most scenarios, and Quick Create forms for fast data entry.
- Avoid overloading forms with too many fields—keep it clean and contextual.
3. Views Customization
Views define how records appear in lists.
Types of Views:
- Public Views (System Views)
- Personal Views (User-specific)
- Associated Views (within related records)
Customization Tips:
- Add only necessary columns to improve performance.
- Sort and filter default views for better user experience.
- Highlight critical fields using conditional formatting.
4. Site Map Customization
The site map is the navigation pane of a model-driven app.
How to Customize:
- Use the App Designer to drag and drop areas, groups, and subareas.
- Link subareas to entities, dashboards, or web resources.
- Customize the label and icon for better UX.
5. Dashboards
Dashboards provide at-a-glance insights into data.
Types:
- User Dashboards: Personalized views.
- System Dashboards: Available to everyone with access.
Customization Tips:
- Use charts and lists that relate to the user’s role.
- Keep dashboards uncluttered—only show essential KPIs.
- Customize filters to allow users to tailor their views.
Business Logic Customization
1. Business Rules
Business rules are no-code logic for form validation and automation.
Capabilities:
- Show/hide fields
- Enable/disable fields
- Set field values
- Display error messages
Best Practices:
- Use business rules for UI-level logic.
- Document all rules for future reference.
- Avoid conflicting rules on the same field.
2. Workflows and Power Automate
Use Power Automate for advanced automation.
Examples:
- Send emails when a record is created.
- Sync data between entities.
- Approvals and notifications.
Tips:
- Use Dataverse triggers (e.g., “When a row is added”).
- Handle errors gracefully (e.g., add a parallel branch to log failures).
- Name flows clearly and document them for maintainability.
3. JavaScript
For client-side logic not possible with business rules, JavaScript is still useful.
Common Use Cases:
- Dynamic field behavior
- Calculations not supported by business rules
- Integrations with third-party APIs
Best Practices:
- Store scripts in web resources.
- Keep functions modular and reusable.
- Avoid heavy computations that can slow form load.
Security and Access Control
Model-driven apps inherit security from Dataverse roles, allowing fine-grained control over data and functionality.
Key Elements:
- Security Roles: Define permissions at the table, record, and field levels.
- Teams and Business Units: Organize users for data access.
- Field-level Security: Mask sensitive data (e.g., salaries, SSNs).
Customization Tips:
- Use least privilege principle—grant only what users need.
- Test with user roles to ensure proper access before go-live.
- Use custom roles rather than modifying out-of-the-box ones.
UI Enhancements
1. Custom Controls
You can replace standard form fields with custom controls for better interactivity.
Examples:
- Numeric sliders
- Pen input for signatures
- Timeline controls
2. PCF (PowerApps Component Framework)
For advanced customization, use PCF to build custom form components.
Use Cases:
- Complex visuals (graphs, calendars)
- Third-party integrations
- Custom input types
Integrations and Extensibility
1. Power Automate
Build logic to:
- Integrate with SharePoint, Outlook, Teams, etc.
- Automate approvals or record updates.
- Respond to events like record creation or update.
2. Power BI
Embed Power BI dashboards directly into model-driven apps.
Tips:
- Use security roles to restrict data visibility.
- Filter reports using record context.
3. Azure Services
For custom APIs or heavy processing:
- Use Azure Functions for backend logic.
- Integrate with Azure Logic Apps or Event Grid.
App Lifecycle Management (ALM)
Environments:
- Dev: For creating and testing features.
- Test/UAT: For validation by QA or business users.
- Prod: Final live environment.
Tools:
- Solutions: Use managed/unmanaged solutions for packaging components.
- Deployment Pipelines: Use Azure DevOps or GitHub Actions for CI/CD.
- Environment Variables: Avoid hard-coding settings.
Governance and Maintenance
Naming Conventions:
- Use clear, consistent names (e.g.,
new_ContactApprovalStatus
). - Prefix custom fields and tables with organization codes.
Documentation:
- Maintain a customization log.
- Document flows, scripts, and rules for future teams.
Performance Tips:
- Avoid loading too many fields or subgrids on a single form.
- Use async Power Automate flows for non-critical logic.
- Monitor performance using Power Platform Admin Center.
Common Pitfalls and How to Avoid Them
- Over-customization: Avoid modifying system tables unless absolutely necessary.
- Duplicating logic: Reuse business rules or flows to avoid redundancy.
- Not using solutions: Always develop and transport using solutions to ensure proper versioning and portability.
- Skipping UAT: Always test in a UAT environment before pushing to production.
- Poor access control: Misconfigured security roles can lead to data leaks or functionality loss.
Real-world Example: Custom Sales App
Imagine a company building a model-driven app for sales reps. Here’s how customization can be applied:
- Custom Tables:
Leads
,Opportunities
,Quotes
- Custom Form: Show different fields based on sales stage
- Custom View: Pipeline view filtered by sales rep region
- Business Rule: Auto-populate quote discount if opportunity > $50K
- Power Automate: Send an email to the sales manager when a high-value opportunity is created
- JavaScript: Calculate estimated revenue based on multiple input fields
- Security Roles: Reps can only see their records; managers can see all