Build a New PCF Grid Component | PL-400 Microsoft Power Platform Developer Exam

NewPCFComponent

Question

You need to build a new PCF grid component with the name “NewPCFComponent” for a model-driven app.

You create a directory for your project and define the namespace “PCFSpace” for the component.

What will be your next two steps to create a PCF component?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E. F. G.

Correct Answers: D and E

The Components are reusable blocks that you can use for Power Apps applications.

Power Apps provides out-of-the-box standard controls (components) for creating applications, like HTML Text, Vertical Gallery, or Edit Form.

If your Power Platform solution requires more than standard controls, Power Apps also provides tools to create and reuse the custom components.

Power Apps Component Framework (PCF) helps you to create these components.

You can import and export components from other applications or store them in the Components Library.

To create a PCF component, Microsoft provides three simple steps: Create a project directory.

Create a new component from the template in a project directory.

Install all dependencies required for your component.

First, you create a directory for your component project.

You can use the mkdir command, like

mkdir NewPCFComponent.

The second step is to create a new component from the template.Microsoft provides two templates for model-driven apps: field and dataset.

A field template is for replacing the field on the form.

A dataset template is for creating a view, grid, or dataset.

In our case, you should use the following expression (Number 1):

pac pcf init --namespace PCFSpace --name NewPCFComponent --template dataset

The pac is the Power Apps CLI (pac) command for the initialization of the pcf component.

The pac creates a set of files and directories.

And the third step is to install all dependencies that you need to run your component (Number 2):

npm install.

© cmd (Admin) = Oo x

Microsoft Windows [Version 10.0.19042.928]

pcf init --namespace PCFSpace --name NewPCFComponent --template dataset
The PowerApps component tramework project was successtully created in ‘c:\uUsers
nt".
Be sure to run ‘npm install’ in this directory to install project dependencies.

c:\Users Dev\Power Platform {

\Dev\Power Platform\PCF\NewPCFCompone

2\ Users \ \Dev\Power Platform\PCF\NewPCFComponent
‘Le snl] @®
N caved

npm i depre chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

npm WANN) deprecated opn@6.@.0: The package has been renamed to ~open™

npm WAM deprecated fsevents@1.2.13: fsevents 1 will break on node vi14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WAM! deprecated resolve-url@@.2.1: https://github.com/lydell/resolve-url#deprecated

npm GAGG) deprecated urix@@.1.0: Please see https://github.com/lydell/urix#deprecated

npm »ol. °° created a lockfile as package-lock.json. You should commit this file.

npm (AMS optional SKIPPING OPTIONAL DEPENDENCY: fsevents@-2.3.1 (node_modules\chokidar\node_modules\fsevents):
npm GAG) notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32", "arch"
"x64" })

npm GAIN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@*1.2.7 (node modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):

npm WAgi) notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {“os":"win32", "arch
"S"x64"})

npm WAMN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@*1.2.7 (node_modules\live-server\node_modules\chokidar\node_modules\fsevents):
npm (ZA notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch
"2"x64"})

npm WARN pcf-project@1.0.@ No repository field.

npm GAGG) pcf-project@1.0.@ No license field.
added 689 packages from 435 contributors and audited 692 packages in 82.056s

37 packages are looking for funding
run “npm fund” for details

found @ vulnerabilities

c:\Users\ . \Dev\Power Platform\PCF\NewPCFComponent

cmd.exe*[*64]:21208 ‘« 171109164] 1/1 [+] NUM PRIt 153x43  (338)25V 14756 100% 2

After these three steps, you can code your component.

Before you run pac and npm commands, you need to install Npm or Node.js.

It is required to run Microsoft Power Apps CLI.

And then, you can install Microsoft Power Apps CLI.

All other options are incorrect.

For more information about creating Power Apps Component Framework (PCF) component, please visit the below URLs:

To create a new PCF component named "NewPCFComponent" with the namespace "PCFSpace" for a model-driven app, you can follow these steps:

  1. Create a directory for your project: First, you need to create a directory to store your PCF component project files. You can create a new folder with a suitable name and navigate to it in your terminal.

  2. Define the namespace for the component: As mentioned in the question, you need to define the namespace for the component as "PCFSpace". This namespace will be used to differentiate your component from others and avoid naming conflicts.

  3. Choose a PCF template: Next, you need to choose a PCF template based on the type of component you want to create. In the given options, you can choose between the "dataset" template and the "field" template. The "dataset" template is used for creating components that display and manipulate data, while the "field" template is used for creating components that can be used as form fields.

  4. Use pac pcf new command: To create a new PCF component, you can use the pac pcf new command with the chosen template, namespace, and name of the component. In the given options, you can choose between options B and G, depending on the chosen template.

  • If you want to use the "dataset" template, you should choose option B, which is "pac pcf new --namespace PCFSpace --name NewPCFComponent --template dataset".
  • If you want to use the "field" template, you should choose option G, which is "pac pcf new --namespace PCFSpace --name NewPCFComponent --template field".
  1. Use pac pcf init command: Alternatively, you can also use the pac pcf init command to create a new PCF component project. This command generates a basic project structure that you can customize and add your own code to. In the given options, you can choose option C or E, depending on the chosen template.
  • If you want to use the "dataset" template, you should choose option E, which is "pac pcf init --namespace PCFSpace --name NewPCFComponent --template dataset".
  • If you want to use the "field" template, you should choose option C, which is "pac pcf init --namespace PCFSpace --name NewPCFComponent --template field".
  1. Install dependencies: Once you have created the project files using either the pac pcf new or pac pcf init command, you need to install the required dependencies for your project. You can do this by running the "npm install" command in your project directory.

  2. Build and test the component: Finally, you can build and test your PCF component by running the "npm run build" command to generate the build artifacts and the "npm start" command to launch the local test environment.

Therefore, based on the given options, the correct steps to create a new PCF component would be either B and D or E and D, depending on the chosen template.