In Power Apps, when using the Patch function in a Canvas app to create or update records in Dataverse, business required fields defined in Dataverse are not automatically enforced. This behavior can be surprising, but it stems from how validation works between Canvas apps and Dataverse.
Here's why this happens:
Canvas apps do not use the same form-based model as Model-driven apps. When you use Patch, you're directly interacting with the Dataverse table via the API, and Dataverse does not enforce business required fields at the API level unless explicitly configured.
2. Business Required ≠Database Required
In Dataverse:
- Business Required means the field must be filled in the UI (e.g., in a Model-driven app form).
- Required at the database level (i.e., non-nullable columns) means the field must be filled regardless of the interface.
So if a field is only marked as Business Required (not database-required), Dataverse allows nulls via API calls like Patch.
3. Patch Only Fails on Database Constraints
If a field is required at the database level, Patch will fail with an error if the field is missing. But for Business Required fields, it will succeed unless you manually enforce the requirement in your Canvas app logic.
How to enforce Business Required fields in Canvas apps
To ensure users fill in required fields before patching:
- Use form validation in your Canvas app.
- Check for empty values before calling
Patch, e.g.:
If(
IsBlank(txtName.Text),
Notify("Name is required", NotificationType.Error),
Patch(MyTable, Defaults(MyTable), { Name: txtName.Text })
)
- Alternatively, use Dataverse business rules or Power Automate flows to validate after submission.
Would you like help writing a validation formula for a specific field or table in your app?