Model-driven App Components – Pros and Cons

Pros and cons of different components for building business logic and user interface in Model-driven apps. The post is inspired by the talk Carmen Ysewijn had at the Nordic Summit community event in Stockholm in 2022. To see the presentation you can find the link here The complete toolbox for designing your model-driven app solutions.

Business Rules

Business rules are used to apply form logic without writing JavaScript code or creating plug-ins. By using a simple interface to implement and maintain fast-changing and commonly used rules. They can be applied to Main and Quick Create forms.

Pros

  • Defined for a table
  • Acts on a form or table level
  • Lock
  • Default value
  • Field value
  • Show or hide fields
  • Validate data and show error messages
  • Set field optional/required
  • Clear field values
  • Create business recommendations based on business intelligence.

Cons

  • No use of related records’ information
  • No interaction with sections/tabs of a form
  • No error handling
  • Only work if all fields used in the rule are present on the form (visible or
  • hidden)
  • No control over the order of execution of multiple business rules for one form/table
  • Can only set fields based on fixed values or values from the record itself
  • Business rules don’t work with multi-select option sets.

Link to documentation: https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-business-rules-recommendations-apply-logic-form?view=op-9-1

Classic Workflows

Workflows are usually used to automate business processes by initiating automation that doesn’t require any user interaction.

Pros

  • Defined related to a table
  • On-demand or automated
  • Synchronous or asynchronous
  • Use code steps

Cons

  • A limited number of actions
    available
  • Only interact with Dataverse and
    other services that provide actions

Link to documentation: https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/workflow-processes?view=op-9-1

Power Automate Cloud Flows

Power Automate is used to automate business processes. Can be triggered either automatically, instantly, or via a schedule. For instance, perform tasks like sending notifications, moving data between data sources, creating/updating/deleting rows based on different events, and more.

Pros

  • Instant, automated, or scheduled
  • Asynchronous
  • Can connect to other data sources or services
  • Complex logic and loops are possible
  • Use all available relational data

Cons

  • Always run in the background
  • Cannot run synchronously
  • Cannot trigger on N:N relationships
  • Cannot use information from a deleted record

Link to documentation: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/getting-started

For more posts about Power Automate check out the Power Automate Category on the site.

(Embedded) Canvas Apps

Create apps without writing code in a traditional programming language such as C#. You can design the app by dragging and dropping elements onto a canvas, just as you would design a slide in PowerPoint. For applying logic and working with data you can create Excel-like expressions.

Pros

  • Use other tables
  • Pixel-perfect control over UI
  • Improve visualization of
    information

Cons

  • Are not part of the form definition
    but load after the form has loaded
  • May require additional licensing

Link to documentation: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/getting-started

Form Scripts

JavaScript is one of the ways to apply custom business process logic for displaying data on a form in Dynamics 365.

Pros

  • Defined for a table
  • Acts on a form
  • Reacts to an event (load, change, save)
  • Can interact with all elements of a form (including tabs and subgrids)
  • Can include error handling
  • Control over the order of operations
  • Can use related record information

Cons

  • Requires coding
  • Can become very complex
  • Not easy for non-developers

Link to description: https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/clientapi/client-scripting?view=op-9-1

Plug-ins

A plug-in is a .NET assembly that you can upload to Microsoft Dataverse. Classes within the assembly can be registered to specific events (steps) within the event framework. The code within the class provides a way for you to respond to the event so that you can augment or modify the default behavior of the platform.

Pros

  • Linked to a table
  • Interfere at a database level
  • Can execute pre, during, or post transaction
  • If done correctly, are the most effective way to apply business logic

Cons

  • Requires coding
  • If done incorrectly, can have a significant impact on performance
    of your solution

Link to documentation: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/plug-ins

PCF Components

Power Apps component framework is used to create code components for model-driven and canvas apps. These code components can be used to enhance the user experience for users working with data on forms, views, dashboards, and canvas app screens.

Pros

  • Improve visualization
  • Use Dataverse API to get
    information
  • Part of the form definition

Cons

  • Developer experience
  • Cannot share packages/libraries across components on the same
    form

Link to documentation: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview

Hope you found it useful!


For More Content See the Latest Posts