Introduction

In Microsoft Power Apps, the Confirm() function is used to display a confirmation dialog to the user before performing an action. It helps prevent accidental operations such as deleting data, submitting forms, or resetting inputs.

The function asks the user a question and waits for their response. Based on the response, it returns a Boolean value:

This allows your app to conditionally execute actions only when the user agrees.

1. Syntax

Confirm( Message [, Options ] )

Parameters

2. Return Value

You usually use Confirm() inside an If() function to control what happens next.

3. Simple Example

Confirm before deleting a record

If(
    Confirm("Are you sure you want to delete this record?"),
    Remove(Employees, ThisItem)
)

Explanation

4. Example: Confirm before submitting a form

If(
    Confirm("Do you want to submit the form?"),
    SubmitForm(Form1)
)

Explanation

5. Example: Confirm before resetting a form

If(
    Confirm("Reset the form? All unsaved data will be lost."),
    ResetForm(Form1)
)

This prevents users from accidentally losing data.

6. Using Confirm with Options

You can customize the dialog.

Confirm(
    "Do you want to continue?",
    {
        Title: "Confirmation",
        ConfirmButton: "Yes",
        CancelButton: "No"
    }
)

Result

Dialog shows:

7. Using Confirm with Variables

Set(
    varConfirm,
    Confirm("Do you want to delete this item?")
);

If(
    varConfirm,
    Remove(Employees, ThisItem)
)

Explanation

8. Practical Example (Gallery Delete Button)

Suppose you have a Gallery showing employee records.

Delete button OnSelect:

If(
    Confirm("Delete this employee record?"),
    Remove(EmployeeList, ThisItem)
)

User must confirm before the record is removed.

9. Best Practices

✔ Always use Confirm() for destructive actions:

✔ Keep messages clear and short

Example good message:

Are you sure you want to delete this record?

10. Difference Between Confirm and Notify

Example Notify:

Notify("Record saved successfully")

Summary

Confirm() is used to:

Conclusion

In Microsoft Power Apps, the Confirm() function is used to display a confirmation dialog to the user before performing an action. It helps prevent accidental operations like deleting or submitting data. The function returns true if the user confirms and false if the user cancels, allowing the app to execute actions only after user approval.