Mastering Power Apps Form Modes: Create, Edit, and View Records Seamlessly
Learn how to use a single form in Power Apps to switch between adding, modifying, and displaying records using NewForm, EditForm, ViewForm, and ResetForm.
In Power Apps, a single form control can serve three distinct purposes: creating a new record, editing an existing record, or displaying a record as read-only. The form's behavior is controlled by its Mode property, which you change by calling the functions NewForm, EditForm, ViewForm, and ResetForm. This article shows you how to implement these modes using a practical example, so you can build apps that let users add, update, and inspect data without requiring multiple screens or forms.
Example Scenario: IT Equipment Checkout
Imagine an IT department that needs to track which employees have checked out equipment. The app will allow a technician to:
- Log a new equipment checkout.
- Update an existing checkout record (e.g., mark equipment as returned).
- View the details of a checkout without accidentally editing it.
We'll use a SharePoint list as our data source.
SharePoint List Setup
Create a new SharePoint list named EquipmentCheckout and add these columns:
| Column Name | Type | Details |
|---|---|---|
| EquipmentName | Single line of text | e.g., "Laptop - Dell XPS" |
| CheckedOutTo | Single line of text | Employee name |
| CheckoutDate | Date and Time | Date only |
| ReturnStatus | Choice | Choices: Returned, Not Returned |
Populate a few sample rows:
| EquipmentName | CheckedOutTo | CheckoutDate | ReturnStatus |
|---|---|---|---|
| Dell Monitor | Alice Chen | 2026-05-10 | Returned |
| MacBook Pro | Bob Ray | 2026-05-12 | Not Returned |
| iPad Air | Carol Smith | 2026-05-15 | Not Returned |
| USB-C Hub | David Lee | 2026-05-18 | Returned |
Building the App
Open Power Apps Studio, create a new blank canvas app, and connect it to your EquipmentCheckout list.
Screen 1: Form Screen
Add a new screen called CheckoutFormScreen. Insert a form control and name it frm_Checkout. Set its DataSource to EquipmentCheckout. Configure the form's fields to show EquipmentName, CheckedOutTo, CheckoutDate, and ReturnStatus. Remove any unwanted fields such as Title or Attachments.
Add a Submit button below the form and set its OnSelect to:
SubmitForm(frm_Checkout)
Screen 2: Gallery Screen
Create another screen named GalleryScreen. Insert a gallery and connect it to the EquipmentCheckout data source. Choose a layout that shows the equipment name and status. Set the gallery’s fields:
- Title →
EquipmentName - Subtitle →
CheckedOutTo - Body →
ReturnStatus
Add an Add icon (or button) in the screen’s title bar to create new records. We'll wire it up later.
Viewing a Record (ViewForm)
When a user selects an equipment record in the gallery, the app should open the form screen in read‑only mode. This prevents accidental changes.
Set the gallery's OnSelect to:
Set(varSelectedEquipment, ThisItem); ViewForm(frm_Checkout); Navigate(CheckoutFormScreen)
On the form screen, set the form's Item property to the variable:
varSelectedEquipment
Now, when you preview the app and tap a gallery item, the form shows the record’s details but all fields are read‑only. The Submit button should be hidden while the form is in view mode. Set the button’s Visible property:
frm_Checkout.Mode <> FormMode.View
Editing a Record (EditForm)
To allow editing, place an Edit icon on the form screen’s title bar. Set its OnSelect to:
EditForm(frm_Checkout)
When the user clicks Edit, the form switches to edit mode, fields become editable, and the Submit button reappears.
Handling Save Success and Failure
Define what happens after the form is submitted. In the form’s OnSuccess property, update the variable to reflect the latest submission, return to view mode, and show a success notification:
Set(varSelectedEquipment, frm_Checkout.LastSubmit);
ViewForm(frm_Checkout);
Notify("Equipment record saved successfully.", NotificationType.Success)For error handling, set the form’s OnFailure property:
Notify("Error: Could not save the record.", NotificationType.Error)When the user taps the Submit button, the form saves the changes and then returns to view mode.
Adding a New Record (NewForm)
To create a new checkout record, use the Add icon on the gallery screen. Set its OnSelect to:
Set(varSelectedEquipment, Blank()); NewForm(frm_Checkout); Navigate(CheckoutFormScreen)
When navigating to the form screen, the form shows empty fields ready for input. The Edit icon should be hidden while in new mode because there is no existing record to edit. Set its Visible property:
frm_Checkout.Mode = FormMode.View
After the user fills in the fields and submits, the record is saved. The OnSuccess handler can be reused—it will automatically switch back to view mode (in this case showing the newly created record).
Resetting the Form on Navigation
When the user leaves the form screen, the form should be reset to clear any leftover data. Add a Back arrow or button to the form screen and set its OnSelect:
ResetForm(frm_Checkout); Navigate(GalleryScreen)
Without ResetForm, the form would still show the previous record’s data when another item is selected from the gallery.
Common Mistakes and Troubleshooting
- Forgetting to set the form’s Item property. If the form doesn't show data after
ViewForm, check that the Item property points to the correct variable or record. - Not resetting the form when navigating back. This results in stale data appearing on the next view.
- Incorrect button visibility logic. Use
frm_Checkout.Mode <> FormMode.Viewfor submit (hide in view) andfrm_Checkout.Mode = FormMode.Viewfor edit (show only in view). Double‑check the operator. - Delegation warnings. When your SharePoint list grows, functions like
ViewFormandEditFormoperate on a single record, so delegation is not an issue. However, gallery data source may hit delegation limits for filtered queries; consider usingSearchorFilterwith delegation‑friendly operators.
Best Practices
- Use descriptive variable names (e.g.,
varSelectedRecord) to avoid confusion. - Keep form OnSuccess logic consistent across both Edit and New modes.
- Use the
FormMode.ViewandFormMode.EditandFormMode.Newenum values instead of magic numbers. - Always call
ResetFormbefore leaving the form screen to ensure a clean slate.
Conclusion
By mastering NewForm, EditForm, ViewForm, and ResetForm, you make your Power Apps more efficient and user‑friendly. A single form can serve multiple states — creation, editing, and read‑only display — reducing the need for duplicate screens and improving maintainability. Apply the pattern shown here to your own apps and adapt it to your business logic.
References
- Original article by Matthew Devaney: https://www.matthewdevaney.com/power-apps-form-modes-newform-editform-and-viewform/
- Microsoft Learn: Power Apps form modes (placeholder – see official docs at https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-forms)