This is a PowerApps Component Framework (PCF) control developed for Dynamics 365 / Dataverse. It allows users to input area values in various units (e.g., Square Feet, Acres, Hectares) and automatically converts and stores them as Square Meters in the underlying Dataverse field.
-
Multi-unit Support: Supports conversion between:
- Square Meter (
$m^2$ ) - Base Unit - Square Kilometer (
$km^2$ ) - Square Foot (
$ft^2$ ) - Square Yard (
$yd^2$ ) - Square Mile (
$mi^2$ ) - Acre (
$ac$ ) - Hectare (
$ha$ )
- Square Meter (
- Real-time Conversion: Automatically converts input values to Square Meters for storage.
- Fluent UI Integration: Built using Fluent UI React controls for a native Dynamics 365 look and feel.
- Precision Handling: Handles decimal precision up to 4 decimal places for accurate storage.
- Node.js: LTS version recommended.
- Microsoft Power Platform CLI: For building and deploying the control.
- Visual Studio Code: Recommended editor.
- Clone the repository (if applicable) or navigate to the project folder.
- Install dependencies:
npm install
- Build the control:
npm run build
To inspect and debug the control in the local PCF test harness:
npm startThis will open a local browser window where you can test the control's inputs and outputs without deploying to Dataverse.
-
Authenticate:
pac auth create --url https://<your-org>.crm.dynamics.com
-
Push to Environment (Quick Deployment for Dev):
pac pcf push --publisher-prefix <your-prefix>
Note: This creates a temporary solution in your environment.
-
Create Solution Package (Production/ALM):
mkdir Solutions pac solution init --publisher-name <name> --publisher-prefix <prefix> pac solution add-reference --path .. dotnet build
- Open your Power Apps environment (make.powerapps.com).
- Go to your Table and find the Number field (Decimal or Whole Number) you want to apply this control to.
- Switch to Classic solution explorer or use the modern Form Editor.
- Add the AreaConverterPCF component to the field.
- Bind the
Area Valueproperty to your field. - Save and Publish the form.
Now, when users enter a value in any unit (e.g., Acres), the system will display that unit but save the equivalent Square Meters value in the database.
AreaConverterPCF/- Source code for the control.index.ts- Entry point for the PCF control.AreaConverter.tsx- React component for the UI.conversion.ts- Logic for unit conversions.ControlManifest.Input.xml- Defines properties and resources.