Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Extending Microsoft Power Apps with Power Apps Component Framework
Extending Microsoft Power Apps with Power Apps Component Framework

Extending Microsoft Power Apps with Power Apps Component Framework: A complete guide to creating, deploying, and improving your code components

eBook
€17.99 €25.99
Paperback
€31.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Extending Microsoft Power Apps with Power Apps Component Framework

Chapter 1: Introduction to the Power Apps Component Framework

One of the most sought-after new features for developers using Power Apps was the introduction of the Power Apps component framework, an extensibility framework for professional developers to create their own code components that can be natively added to model-driven or canvas apps. This chapter aims to introduce you to the framework and how it improves user interaction with an application. In a step-by-step manner, we will look at the various facets of the Power Apps component framework and end the chapter by preparing our machine for the upcoming chapters.

In this chapter, we are going to cover the following main topics:

  • Overview of the Power Apps component framework
  • Understanding the difference between the Power Apps component framework and HTML web resources
  • Getting to know the licensing requirements
  • Exploring the advantages of the Power Apps component framework
  • Preparing your development machine

Learning some terminology

Before we begin, there is some terminology used throughout the book, and in this section, we are going to get familiar with it.

Dataverse is a platform that not only stores data in a logical manner but also provides security and audit capabilities around data. It provides a rich set of APIs and connectors. It also enables developers to extend the platform to accomplish their custom requirements. It was previously known as Common Data Service (CDS).

Web resources are special files that help extend the Dataverse platform. There are different types of web resources. One such type is HTML, which extends the Dataverse platform by providing the ability to embed HTML components on forms, sitemaps, and dashboards.

Xrm context is an object provided by the Dataverse platform that helps developers to extend the platform by providing access to data, metadata, and some additional functions. Xrm context is crucial to extending the platform as it enables developers to integrate web resources with the platform to fulfill custom requirements.

Now that we understand some of the terminology, let's get an overview of the Power Apps component framework.

Overview of the Power Apps component framework

This section is all about gradually familiarizing ourselves with the framework. Let's first understand what exactly the Power Apps component framework is and why we need it. It is important to understand how the Power Apps component framework evolved before we move on to learning about the differences between the Power Apps component framework and HTML web resources, as well as the licensing requirements and the advantages of using this framework.

What is the Power Apps component framework?

The Power Apps component framework, otherwise known as PCF, is defined by Microsoft as a framework that empowers professional developers and app makers to create code components for model-driven apps and canvas apps to provide enhanced user experience for users to work with data on forms, views, and dashboards. But what does that mean? It means that now professional developers can create widgets that can be configured by the system customizer or an app maker easily, extending the capabilities of any application. Some examples include transforming a numeric field into a slider or transforming a list of appointments into an entirely different visual, such as a calendar.

Originally, it was named Custom Control Framework (CCF) and later renamed to Power Apps Control Framework, but that name did not stick for too long and it was finally renamed to the Power Apps component framework (PCF). Before releasing this framework for public use, Microsoft was using it internally to create a lot of components on a unified interface, one such component being editable grids.

PCF allows professional developers to use a multitude of libraries and services of their choice and add these reusable components to any model-driven or canvas app. Other than providing usability, the framework also provides powerful capabilities for advanced interactions. To facilitate the development of code components, the Microsoft Power Apps CLI tool enables component creation, easy debugging, built-in validation, and testing using a code editor of your choice.

PCF resolves some of the drawbacks we had for a long time with HTML web resources, such as the lack of flexibility and portability, by providing the ability to package a component with parameters. This means your component is abstracted from an environment and made into a truly reusable component. For example, say you want to show a weather forecast depending on the zip code from an entity record. If we had to do this using an HTML web resource, we would have to keep the forecast API information either hardcoded or in a configuration entity. To do the latter would mean an extra line of code. Also, because we want to read the zip code from the entity record, we would have to fetch the Xrm context using the window.parent method. This is simplified using PCF by using the parameters on the control configuration form. With the same example, you can capture the forecast API information as a component property and access the zip code data using the framework's context object, which provides a neat out-of-the-box way to access an attribute's data. We will be looking into this framework's context object further in later chapters.

Note

At the time of writing this book, PCF does not work on on-premises instances.

Now that you understand what PCF is and its history, let's look at who exactly it caters to.

Who is it focused on?

When Microsoft introduced the low-code-no-code platform, there were two terms used within the realm of business applications: citizen developer and professional developer. Citizen developers are not developers in the regular sense, and they may not know a coding language, but they are still involved in the development process through using low-code tools, such as canvas apps, Power Automate, and so on. These tools may not necessarily be straightforward and there is a bit of learning needed to use them. Professional developers are the ones who are more heavily involved in the development process and extend their platforms using various programming languages. These developers may create reusable components that can be utilized by citizen developers.

PCF is targeted more at professional developers, as along with knowledge of the framework, you also need basic knowledge of TypeScript, npm, and the web development process. This framework enables you to create code components that can be used by citizen developers on model-driven or canvas apps. Hence, now more than ever, we need a collaborative effort between citizen developers and professional developers to create holistic and usable systems.

If you are a professional developer with basic knowledge of JavaScript and Dataverse but you do not possess working knowledge of TypeScript or npm, do not worry, as this book will provide ample support for you to understand the basics needed to build a code component.

Note

The code components built using PCF are sometimes also referred to as custom controls.

Next, we will learn the difference between HTML web resources and code components and understand the reasoning behind keeping both HTML web resources and code components.

How are code components different from HTML web resources?

Now, you may wonder, do you need HTML web resources if you have code components? The answer is yes, we still need HTML web resources, and as of today, both have their own distinct ways that offer you full flexibility in customizing your system. For instance, code components can only be tied to a field or a dataset; so, if you have a requirement to add a custom piece of functionality to a dashboard that cannot be accomplished using iFrames or charts, you will still have to resort to HTML web resources.

The following table shows us some of the notable differences between HTML web resources and code components:

Table 1.1 – HTML web resources versus code components

Table 1.1 – HTML web resources versus code components

As you can see from the preceding table, HTML web resources help where PCF lacks and vice versa, providing you with full flexibility in customizing your application. Let's now look at the licensing needs.

Getting to know the licensing requirements

How a code component interacts with an external service determines the licensing scheme for the app that consumes the code component. The two license classifications are as follows:

  • When an app uses a code component that connects with an external service, it becomes premium, and end users need to have a Power Apps license.
  • If code components do not consume an external service, then the usage of such components in an app requires users to at least have a license for Office 365.

    Note

    A code component cannot be used in Dataverse for Teams.

Now that we understand the licensing requirements, let's go through the advantages of using PCF.

Exploring the advantages of PCF

When developing code components using PCF, it is important for you to know some of the advantages of the framework. They are as follows:

  • Access to a rich set of framework APIs that grant capabilities such as managing component life cycles and getting contextual data and metadata information.
  • Seamless server access through a web API, utility, and data formatting methods.
  • Access to device features, such as camera, location services, and microphone.
  • Provides a quickstart template that uses npm packages and webpack.
  • Optimized for performance.
  • Unlike HTML web resources, which get rendered as an iFrame, code components are rendered as part of the DOM, which provides an enhanced and seamless user experience.
  • Developers can utilize Power Apps capabilities to the fullest; for example, they can use the command bar on sub-grids.
  • Based on how code components are created, PCF can support both model-driven and canvas apps. We will be looking at the cases when a code component cannot support canvas apps in later chapters.

These are just some of the advantages of PCF. Let's now look at how to prepare your machine, which will help us develop the code components.

Preparing your development machine

There are some prerequisites you need to install before you can start building the code components that we will be using in this book. In the following subsections, we will look at each of these prerequisites in detail and examine the processes required to get these tools installed.

Node.js or npm

The first prerequisite is Node.js or npm; you do not need both because if you install one, the other gets installed as part of it.

Node.js helps users to build scalable applications using an asynchronous event-driven runtime engine.

npm is an open source JavaScript and TypeScript package registry. It has a command-line interface that enables developers to interact with it.

For installation, browse to https://nodejs.org and choose the latest LTS version available for download. Once the file is downloaded, execute it to install it on your machine:

Figure. 1.1 – Node.js download

Figure. 1.1 – Node.js download

Once the installation is complete, you can check the status by opening a command prompt and running the npm version command, which should show you the npm version installed on the machine.

TypeScript

Once you have installed these prerequisites, you need to make sure you have TypeScript installed on the machine. To check whether TypeScript is already installed on your machine, open the command prompt and execute the following command:

tsc -v

If the response from the command shows a version number, then you already have TypeScript installed on your machine, but if the response states that the command is not recognized, then you need to install TypeScript on your machine.

TypeScript can be installed through npm using the following command:

npm install -g typescript

-g means it is installed on your system globally so that the TypeScript compiler can be used in any of your projects. Once the installation is complete, you can execute tsc -v to confirm it.

.NET Framework

Next, you need to make sure the .NET Framework 4.6.2 developer pack is installed on your machine. To check whether 4.6.2 version is already installed on your machine, do the following:

  1. Open Visual Studio Installer. If you do not have Visual Studio Installer, then you can download the latest version of Visual Studio from https://visualstudio.microsoft.com/downloads.
  2. From the More option for the latest version of Visual Studio, select Modify, which will bring up the Installation details window.
  3. Make sure the ASP.NET and web development option is checked.
  4. On the right-hand panel, under ASP.Net and web development, confirm that .NET Framework 4.6.2 development tools is checked. If it is not installed, then check the box and click on the Install while downloading button, as seen in the following screenshot:
Figure. 1.2 – .NET Framework 4.6.2 installation

Figure. 1.2 – .NET Framework 4.6.2 installation

Visual Studio Code

While you can use any preferred integrated development environment, for the development in this book, we are going to use Visual Studio Code.

Visual Studio Code is a free source code editor made by Microsoft for Windows, Linux, and macOS. Its features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.

If you do not have Visual Studio Code installed on your machine, you can install it from https://code.visualstudio.com/download.

Power Apps CLI

The most important tool in enabling a developer to interact with PCF and empowering them to create, test, debug, and deploy code components is Power Apps CLI. To download it, browse to https://aka.ms/PowerAppsCLI. Once downloaded, install it on your machine.

Note

Currently, Power Apps CLI is only supported on Windows 10.

To confirm the installation, open the command prompt and run the pac command. It should show an output as follows:

Figure 1.3 – Executing the pac command

Figure 1.3 – Executing the pac command

Once your machine has been prepared with all the prerequisites, you need to download the example library.

Downloading the example library and using the practice questions

Throughout this book, you will be creating some sample controls, and to help you validate those controls, a library has been published on GitHub for you to download.

To download the library, navigate to https://github.com/PacktPublishing/Extending-Microsoft-Power-Apps-with-Power-Apps-Component-Framework.

In this book, at the end of each chapter, you will find questions to test the knowledge and skills you have acquired. Each question will show you the points you will earn if you answer it correctly. There are 5,000 points to be earned overall. The answers to those questions can be found at the end of the book.

At this point, you should have all the tools and content you need to build your own code components throughout the book.

Summary

Power Apps component framework is the next level of development framework, enabling developers to extend any type of Power Apps app. We introduced PCF, looked at the key differences between code components and HTML web resources, learned about the licensing requirements, and talked about PCF's advantages. We ended the chapter by learning about the installation processes for all the prerequisites of the book to set ourselves up for the upcoming chapters.

In the next chapter, we will look at the Power Apps CLI tool, which helps in the initialization of various projects.

Test your knowledge

  1. Are HTML web resources still needed when we can just use code components built using PCF? (100 points)

    a. Yes

    b. No

  2. When does an app that has implemented a code component built using PCF need a premium Power Apps license? (100 points)

    a. When a code component does not use an external service

    b. When a code component uses an external service

  3. What is the one crucial application that you need to install in order to prepare your development machine for building code components? (200 points)

    a. Visual Studio Code

    b. Power Apps CLI

Further reading

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand how to extend Power Apps' capabilities
  • Enhance your skills with the help of practical code components used throughout the book
  • Overcome common challenges, avoid pitfalls, and improve your code

Description

Power Apps Component Framework is used by professional developers to extend the capabilities of model-driven and canvas apps. Extending Microsoft Power Apps with Power Apps Component Framework will take you through the basic as well as advanced topics using practical examples. The book starts by helping you understand the fundamentals of the framework, its lifecycle, and the tools that you'll use to build code components using best practices and file management guidelines. You'll then learn how to extend Power Apps step by step and apply the principles and concepts covered in the book to build code components for field type attributes. The book covers different ways of debugging code components and guides you through the process of building code components for datasets. You'll also explore the functions and methods provided by the framework to enhance your controls using powerful sets of libraries and extensions. As you advance, you'll get to grips with creating and managing authentication profiles, discover different ways of deploying code components, and configure code components in model-driven and canvas apps. Finally, you'll learn some of the important features of the framework and learn modern web development practices. By the end of this Power Apps book, you'll be able to build, debug, enrich, and deploy code components confidently.

Who is this book for?

This book is for developers who are looking to build advanced skills for extending the capabilities of Power Apps. Basic knowledge of Power Apps and web development is necessary to get started with this book.

What you will learn

  • Understand the fundamentals of Power Apps Component Framework
  • Explore the tools that make it easy to build code components
  • Build code components for both a field and a dataset
  • Debug using test harness and Fiddler
  • Implement caching techniques
  • Find out how to work with the Dataverse Web API
  • Build code components using React and Fluent UI controls
  • Discover different deployment strategies

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 26, 2021
Length: 318 pages
Edition : 1st
Language : English
ISBN-13 : 9781800564022
Vendor :
Microsoft
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 26, 2021
Length: 318 pages
Edition : 1st
Language : English
ISBN-13 : 9781800564022
Vendor :
Microsoft
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 107.97
Workflow Automation with Microsoft Power Automate
€41.99
Extending Microsoft Power Apps with Power Apps Component Framework
€31.99
Microsoft Power Apps Cookbook
€33.99
Total 107.97 Stars icon

Table of Contents

17 Chapters
Section 1: Fundamentals of the Power Apps Component Framework Chevron down icon Chevron up icon
Chapter 1: Introduction to the Power Apps Component Framework Chevron down icon Chevron up icon
Chapter 2: Power Apps CLI Chevron down icon Chevron up icon
Chapter 3: Community Tools and Resources Chevron down icon Chevron up icon
Chapter 4: Project Overview and the Component Life Cycle Chevron down icon Chevron up icon
Section 2: Building and Managing Code Components Chevron down icon Chevron up icon
Chapter 5: Code, Test, and Repeat Chevron down icon Chevron up icon
Chapter 6: Debugging Code Components Chevron down icon Chevron up icon
Chapter 7: Authentication Profiles Chevron down icon Chevron up icon
Chapter 8: Introduction to the Dataverse Project Chevron down icon Chevron up icon
Chapter 9: Configuring Code Components in Power Apps Chevron down icon Chevron up icon
Section 3: Enhancing Code Components and Your Development Experience Chevron down icon Chevron up icon
Chapter 10: Diving Deep into the Features Provided by PCF Chevron down icon Chevron up icon
Chapter 11: Creating Advanced Dataset Code Components Chevron down icon Chevron up icon
Chapter 12: Enriching Your Dev Experience Chevron down icon Chevron up icon
Answers to Knowledge Tests Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(14 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Angela Sawh Oct 07, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This text book provides a very comprehensive description about creating components using Power Apps. I have been able to implement the process of setting up the environment and developing a component without issue.
Amazon Verified review Amazon
Betim Beja Jun 06, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book published on February 2021 still holds strong value even though the platform has evolved. Danish did a great work in giving a hand to anyone starting PCF Development. Definitely a must-read book even for experienced developers.
Amazon Verified review Amazon
Nicholas Castro Jul 28, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book covers all of the bases when it comes to PCF development! My favorite parts of the book are the test your knowledge multiple choice questions at the end of each chapter, the chapter on debugging which provided multiple ways to debug and test code components and the final section of the book that shows you how to create production ready PCF components and enhancing your development experience. This book is a must have!
Amazon Verified review Amazon
Placeholder Jul 09, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Probably the best content available for anyone who is not only looking to get started in building PCF controls but also is looking to enhance their skills. Beginner to a pro, the book has it everything that a developer would need to simply accomplish the job. Kudos to Danish for the amazing work
Amazon Verified review Amazon
R. Birkelbach Mar 22, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A comprehensive explanation of PCF development, considering all aspects like: project setup, customizing, debugging, testing, deployment, lifecycle management. The author is also a community contributor, so you get to know from the first hand about community resources but also about the official ones.From experience I know that PCF sdk is only a starting point, but you will need to answer a lot of questions by yourself. This book gives you the answers, helps you to understand the principles, but also to deep dive extended techniques and topics about the field and dataset type components. The learned content is demonstrated by examples and gives you the chance to test your knowledge after each chapter.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.