PL 400 :package, deploy, and consume the component (Create a Power Apps Component Framework (PCF) component)

Package is the generic term in software industries, it makes code easy to reuse and share. Packages are a form of program compilation that are grouped together to be publicly used or provided for deployment. It cannot be modified or changed even if required. The essential definition says that, once several software packages are grouped together during a bundle and provide a solution to the people.


To use a code component in Power Apps, it must be deployed in a built-in Microsoft Dataverse environment. To deploy a component, first task is to package your code component into a solution file that can then be distributed for import. After implementing the code components using the Microsoft Power Platform CLI, the next step is to bundle all the code component elements into a solution file and import the solution file into the Dataverse so that we can view the code components at runtime.

  • To create a new solution project:

pac solution init --publisher-name newCodeComponent --publisher-prefix newCC

The publisher-name and publisher-prefix values must be unique under environment.

  • After the solution file creation, we need to add the reference using the below command:

pac solution add-reference --path c:\newCodeComponentfolder\TestSampleComponent

  • To generate a zip file from the solution project, go into solution project directory and the build the project using the following command:

msbuild /t:build /restore

  • The generated solution files are located inside the \bin\debug\ folder after the build is successful.
  • Manually import the solution into Dataverse using the web portal or automatically using the Microsoft Power Platform Build Tools.

To Consume the code component in the model driven apps:

  1. Navigate to Settings > Customizations > Customize the System.
  2. Expand Entities, expand the table that we want, such as the Opportunity table, select Forms, and then open a form such as the Main form.
  3. In the form editor, double-click the column where we  want to add a code component, such as the Budget Amount column on the opportunity main form. we can also create a custom column.
  4. On the Field Properties page, select the Controls tab, and then select Add Control.

Add code components to a canvas app

  • Go to Power Apps Studio.
  • Create a new canvas app, or edit an existing app to which we want to add the code component.
  • On the left pane, select Add (+), and then select Get more components.


Comments

Popular posts from this blog

Powering Up Your Analytics: Exploring Power Query in Power BI

Power App Component Overview : Canvas App vs Model-Driven App

Exam PL-400: Microsoft Power Platform Developer