Microsoft Power Automate, Power Platforms

3 Mins Read

Model-Driven Apps and its Customization with Code

Voiced by Amazon Polly

Introduction

A low-code/no-code platform called Power Apps is used to create apps based on Excel workbook formulas like SUM and TEXT. Power Apps can be used to create basic solutions like status reports and vehicle inspection forms, Visitor management, Inventory handling or they can be used to create sophisticated corporate solutions like purchasing procedures and control.

There are two categories of Power Apps – Canvas and Model-Driven App. In contrast to canvas applications, which are developed screen-by-screen by adding logic and code as you go, model-driven applications are made in a few easy stages. Apps that are model-driven are developed using a component-focused methodology.

Enhance Your Productivity with Microsoft Copilot

  • Effortless Integration
  • AI-Powered Assistance
Get Started Now

Model-Driven Apps

The goal of model-driven app design is to use an app designer tool to add elements to tables, such as views, charts, dashboards, and forms. Relationships also get the tables along in a way that makes it possible to navigate between them and prevents redundant data entry. Pages, data, and automation are the components of a model-driven application’s design. The screens that your users can go to within your app are called pages. Data consists of all the Dataverse tables included in your application as well as the option to add additional tables from the Environment. Any business process flows included in your app are included in automation, as is the ability to add new processes.

Before you assemble your application, it’s crucial to make sure that your business data and business processes at the data level are formatted correctly, but you can also make changes as you go. A responsive user interface (UI) is automatically produced by model-driven apps; however, this result greatly depends on how your data is modelled in Dataverse. To enhance the features of the model-driven app, pro developer capabilities like client scripting can be introduced.

Model-Driven Apps and its Customization with Code

JavaScript can be used to develop custom business logic in Power Apps model-driven apps through client scripting. In situations where declarative business rules aren’t suitable, client scripting ought to be considered as a backup plan. In reaction to form events, client scripting operates on a model-driven form. The most frequent events for which event handlers can be registered are as follows: Form loading, a column’s data getting changed, Form saving.

There are three areas where JavaScript can be utilised in model-driven applications:

  1. Form Script event handlers: JavaScript web resources have functions that can be configured to be called by form event handlers.
  2. Commands on the command bar (ribbon): To create actions that call functions defined in JavaScript web resources, utilise the or components.
  3. JavaScript web resources can be used within HTML web resources, as web resources and IFRAMEs. Scripts contained in HTML web resources included in a form, or IFRAMES set to permit cross-site scripting, may communicate with the Xrm.Page or Xrm.Utility.

Setting Up Client Scripting for Forms

To use client scripting on a form, the script needs to be submitted as a script web resource first. Script web resources can be used to manage libraries of JavaScript or TypeScript client script functions. These libraries can then be used from the command bar definition or from within model-driven application forms. It needs to be transpiled to JavaScript when using TypeScript to be uploaded as a web resource.

Managing Script Dependencies

You can set up dependencies on additional online resources in addition to data requirements. When you register a script for a form event, ribbon command, or ribbon enable rules, the form doesn’t need to explicitly load many dependent web resources, which saves time and simplifies the loading logic. You can load the extra resources your code needs by letting the dependency configuration load them while you register the primary script. It’s crucial to understand that dependencies on web resources don’t provide you any control over the sequence in which they load. Every web resource loads simultaneously and asynchronously.

Associating Script Libraries with Forms

Client script libraries can be linked to ribbon commands and form events after they are set up as a script web resource. Select the Form libraries in the toolbar, then click Add library to link a script to a form.

Maintaining and Publishing Script Libraries

No matter how many event handlers you register on a particular form, you only need to associate the script library with the form once per script. If modifications are needed after the initial upload while you’re developing your client script logic, go back to the script web resource in the solution and upload the updated file. To ensure that the app uses the most recent updates, you must publish the script web resource after uploading it.

There is a rich and comprehensive client API object model. You discover that you can leverage a wide range of API objects and methods to implement your reasoning as you become more comfortable with client programming.

Conclusion

When business rules or other declarative approaches aren’t practical, client scripting offers sophisticated ways to incorporate business logic into your model-driven applications. A powerful API is exposed via client scripting. You can interact with the data in the underlying Microsoft Dataverse, work with the user interface, and change how the model-driven application behaves.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery Partner and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

WRITTEN BY Sushma Uday Kamat

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!