• About Me
  • About this blog
  • Disclaimer

XRM Enterprise

Rami's blog dedicated to building enterprise scale XRM applications on the Power Platform

Power Apps PCF Simplified

December 9, 2019 by Rami Mounla

About 20 years ago I wrote my first Hello World Java program. I felt like the sky was the limit – literary as I was considering writing code for a rocket. Today I felt the same write my first PCF control.

In this post I’ll go over the 5 steps you need to know to write a very simple custom control header in PCF.

SimpleHeader PCF Control

What does my control do?

Background

Whenever a UX expert with no Power Apps experience gives me advise on how to improve my forms, they always ask for a formatted header or description text to provide users with context.

In the past, we had a few awkward techniques to do that in model-driven apps. But then I thought why not make an out of the box control for it?

The control I built does exactly that, it simply displays pre-configured formatted text. It is meant to remain static similar to headers, tooltips, or description fields.

How to implement it?

Prerequisite

Before you start ensure you have the all prerequisites installed (npm, Power Apps CLI, VS code at least) as explained in https://docs.microsoft.com/en-us/powerapps/developer/component-framework/get-powerapps-cli

Steps

  1. In a folder called SimpleHeader  I ran the following command using the VS Developer Command Prompt
pac pcf init --namespace XrmEnterprise --name SimpleHeader --template field
  1. Followed by
npm install
  1. I then launched VS code and opened the sub folder SimpleHeader\SimpleHeader and updated the ControlManifest.Input.xml where I replaced the default property with
<property name="info" display-name-key="InputText" description-key="Text to appear in header" usage="bound" of-type="SingleLine.Text" required="true" default-value="Header" />
<property name="headerText" display-name-key="Title Text" description-key="Text to appear in header" usage="input" of-type="SingleLine.Text" required="true" default-value="Header" />
  1. In the init method I added the following 4 lines code
var divHeader: HTMLDivElement;
divHeader = document.createElement("div");
divHeader.innerText = context.parameters.headerText.raw + ""; 
container.appendChild(divHeader); 
  1. Finally I then ran the two commands in the same folder using VS Developer Command Prompt
npm run build
Npm start

At this stage the control is ready for testing on a local test harness. Easy, give it a try….

Simplification Explained

Notice how I did not follow the available online examples. As a strarter created my own static property called headerText of type input. In the index.ts I am not doing anything with the context so I did not bother storing it in a local variable. Instead in my init method I created a div with the headerText as inner text and attached it to a passed in container.
The update view remains empty as I only initialize the control and I do not update it later. It’s static right…

What next?

So far the text is not formatted. My next post will demonstrate how to enhance this example to also include formatting.

This code in available in my GitHub repository https://github.com/ramimounla/SimpleHeader

Rami Mounla
Posted in: Microsoft Dynamics CRM Tagged: #MsDyn365, #PCF, #PowerApps, Custom Controls, Dynamics 365, Microsoft Dynamics 365

About Me

Power Platform enthusiast with a bit of solution architecture on the side.

Recent Posts

  • Best 10 Power Platform Features – 2026 release Wave 1
  • Dataverse + Git Pull and Conflict Resolution
  • Native Dataverse Git Repository Integration
  • PAC CLI Cheat Sheet
  • Best 10 Dynamics 365 Features – 2024 release Wave 2

Archives

  • March 2026
  • November 2024
  • September 2024
  • July 2024
  • January 2024
  • July 2023
  • December 2022
  • August 2022
  • July 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • June 2021
  • April 2021
  • January 2021
  • October 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • August 2019
  • March 2019
  • September 2017
  • August 2017
  • October 2015
  • August 2015
  • June 2015
  • May 2015
  • March 2015
  • February 2015
  • January 2015
  • September 2013
  • August 2011
  • March 2011
  • March 2010

Tags

#MSBizAppsSummit #MsDyn365 #PCF #PowerApps #powerplatform AI Automated UI Testing Automation Bing Map CDS Client API Concurrency Control Concurrent Custom Controls Customer Engagement Data Access Dataflow Deployments DevOps Dynamics 365 Dynamics365 Dynamics CRM 2013 EasyRepro FastTrack JavaScript Microsoft Dynamic 365 Microsoft Dynamics 365 Microsoft Dynamics CRM 2011 Microsoft Dynamics CRM 2013 Microsoft Dynamics CRM 2015 MSDyn365 MVP ODATA Power Apps Power Platform Release Notes Release Plan REST SOAP TechTalk TeckTalk Tracing Unit Testing Wave 1 2020 Wave 1 2022

Categories

  • Automation
  • Conference
  • Configuration
  • Customisation
    • Client API
    • Integration
  • DevOps
    • Test Automation
    • UI Testing
  • Dynamics 365
  • Microsoft Dynamics 365
    • EasyRepro
    • Fast Track
  • Microsoft Dynamics CRM
    • Microsoft Dynamics CRM 2011
    • Microsoft Dynamics CRM 2013
    • Microsoft Dynamics CRM 2015
    • Microsoft Dynamics CRM 4.0
    • Settings
  • Power Platform
    • Canvas App
    • Ideas – GPT-3
    • Power Automate
    • TechTalks
  • Productivity
  • Wellington Dynamics User Group

Copyright © 2026 XRM Enterprise.

Omega WordPress Theme by ThemeHall