Schema-Driven CRUD Form Dialog | Downloadable Example App | Quick Guide
Why I Built This Component
After building multiple CRUD apps, repetitive form maintenance became painful:
- duplicated controls
- Patch logic all over the place
- layout inconsistencies
- hardcoded validation everywhere
Wanted to explore a more configurable + maintainable approach for Canvas Apps at scale.
Downloadable here: https://github.com/KiMi5555/PowerApp_Schema-Driven_CRUD_Dialog
Core Idea
Instead of manually creating forms for every table/entity:
- define a
FormSchema - render fields dynamically through a gallery
- collect standardized
FormData - Patch normally afterwards
The goal is to make forms:
- reusable
- configurable
- easier to maintain
- less tied to specific data sources (Source-Agnostic, even Excel)
Current Features
- Dynamic field rendering
- Text / Dropdown field support
- Schema-driven labels
- Structured
FormDataoutput - User Defined Form CRUD flow/logic
- Reusable dialog component
Still WIP:
- validation system
- more field types
- cleaner schema DX
Component Quick Usage Guide
Setup Video Available Here: https://www.reddit.com/r/PowerApps/s/grbYPd2a02
1. Prerequisite (Initial Setup)
In your Own App, ensure:
- Component is Imported and Inserted
(MyComponent) - Reorder
MyComponentto the FRONT. - Gallery of your Data Source
(MyGallery) App.OnStart( )=Set(gbl_IsDialogOpen, false); Set(gbl_DialogMode, "New");MyComponent.Width=Parent.WidthMyComponent.Height=Parent.HeightMyComponent.Visibile=gbl_IsDialogOpenMyComponent.DialogMode=gbl_DialogModeMyComponent.SelectedRecord=MyGallery.SelectedMyComponent.OnEdit=Set(gbl_DialogMode, "Edit")MyComponent.OnDialogClose=Set(gbl_IsDialogOpen, false)
2. Define Your Form Schema
In App.Formulas, define your Form Schema
Example:
MyFormSchema = Table(
{
Type: "text",
Label: "Title",
Required: true,
SelectedValue: MyGallery.Selected.Title
},
{
Type: "dropdown",
Label: "Department",
Required: false,
SelectedValue: MyGallery.Selected.DeptCode
Items: AddColumns(
MyDepartmentSource,
ItemLabel,
ThisRecord.DepartmentName,
ItemValue,
ThisRecord.DepartmentCode,
}
)
Refer to the Table below to customize your Form Fields.
| Param | Input Type | Explanation |
|---|---|---|
| Type | "text" // "dropdown" |
Defines the Field Type. For now, only text & dropdowns are supported. More will be added later on. |
| Label | Text | A Unique Identifier for your Field Label/Header. This is also used for LookUp() when using FormData |
| Required | Boolean | Whether the Field can be left blank. As of now, is broken and may not work properly. TBC :3 |
| SelectedValue | Selected Gallery Item's Property | The Data Referred to when Dialog is in Edit Mode. |
| Items | AddColumn( DropDownData, ItemLabel, ThisRecord.<ColA>, ItemValue, ThisRecord.<ColB> |
ItemLabel = Dropdown Options to Render, ItemValue = Value each Option Holds |
3. Pass Schema Into Dialog
The dialog dynamically renders fields based on the schema configuration.
MyComponent.FormSchema = MyFormSchema
4. Custom Form Logic + Centralised FormData
The Form Events OnCreate() / OnSave()/ OnDelete() can be customized to cater to your business needs and requirements.
The FormData can be accessed using LookUp(Self.FormData, Label = "MyLabel").Value
// Sample Code for OnCreate() / OnDelete()/ OnSave()
// OnCreate
Patch(
MyDataSource,
Defaults(MyDataSource),
{
ID: GUID(),
Title: LookUp(Self.FormData, Label = "Title").Value,
Department: LookUp(Self.FormData, Label = "Department").Value
}
);
// OnDelete()
Remove(MyDataSource, MyGallery.Selected);
// OnCreate
Patch(
MyDataSource,
Defaults(MyDataSource),
{
Title: LookUp(Self.FormData, Label = "Title").Value,
Department: LookUp(Self.FormData, Label = "Department").Value
}
);
Feedback Please ❤️
Would love feedback / ideas from others experimenting with similar patterns.