BuilderVault
Cookbook

Power Apps Patch Cookbook

Copy-ready Patch patterns for SharePoint, Dataverse, validation, generated IDs, and reliable save behavior in canvas apps.

Power Apps PatchPatch SharePointPatch DataversePower Fx save formula

Who this helps

Power Apps makers who need dependable save formulas instead of one-off trial-and-error code.

What to standardize

  • Choose the correct Patch shape before wiring a submit button.
  • Handle SharePoint person, choice, lookup, and metadata fields explicitly.
  • Return saved records and show meaningful success or failure messages.
  • Pair save formulas with validation and post-save navigation.

Examples

Create a SharePoint request

Create a new request and handle success or failure in one place.

Formula / code
IfError(
    Patch(
        Requests,
        Defaults(Requests),
        {
            Title: txtTitle.Text,
            RequestStatus: { Value: "Submitted" },
            SubmittedBy: {
                Claims: "i:0#.f|membership|" & Lower(User().Email),
                DisplayName: User().FullName,
                Email: Lower(User().Email),
                Department: "",
                JobTitle: "",
                Picture: ""
            }
        }
    );
    Notify("Request submitted.", NotificationType.Success),
    Notify("The request could not be saved.", NotificationType.Error)
);

Expected result: The item is created, user feedback is clear, and the saved record can be reused for navigation or audit labels.

Common mistakes

  • Patching person fields as plain text
  • Showing success before Patch finishes
  • Ignoring IfError

Validate before save

Block incomplete submissions before data reaches the list or table.

Formula / code
If(
    Or(IsBlank(txtTitle.Text), IsBlank(cmbPriority.Selected), IsBlank(dpDueDate.SelectedDate)),
    Notify("Add a title, priority, and due date before submitting.", NotificationType.Warning),
    Patch(Requests, Defaults(Requests), { Title: txtTitle.Text, Priority: cmbPriority.Selected, DueDate: dpDueDate.SelectedDate })
);

Expected result: Users cannot submit incomplete records, and required-field logic is easy to maintain.

Common mistakes

  • Using vague error messages
  • Letting duplicate saves happen
  • Hiding validation across many controls