Scenario: after seeing in the previous post How To install PowerApps CLI (command line interface) to create, debug and deploy custom components using PCF now we will see the basic things you need to develop your first custom control with PowerApps Component Framework PCF.
Solution: When you develop a custom control you need to know the basic architecture that makes up a typical custom control. Below is illustrated the common structure of each custom control:
This is the primary file that define the behavior of the control, what data type it supports and the custom properties.
Any custom component that you want develop has its lifecycle, starting from initialization to rendering on the CRM form. It is always necessary to implement the following methods into index.ts file.
- init: initialize the control. Here you build your control with the HTML elements that would be rendered on CRM forms.
- updateView: fired when any property of your control changes (value or metadata related to field, eg. visibility).
- getOutputs: called by framework when the data related to control changes.
- destroy: called by framework when component is removed from DOM tree.
Hope it helps and happy 365Power’ing!