Latest Posts

PowerApps Display notification message to the user


The Notify function in Power Apps is used to display a notification message to the user. This function is particularly useful for providing feedback, alerting users to errors or success, and guiding them through the app's process.

PowerApps – Notify() function Syntax

Notify(Message [, NotificationType] [, Timeout])

  • Message: The message to display in the notification.
  • NotificationType (optional): The type of notification to display. It can be NotificationType.Information, NotificationType.Success, NotificationType.Warning, or NotificationType.Error. The default is NotificationType.Information.
  • Timeout (optional): The duration in milliseconds for which the notification is displayed. The default is 3000 milliseconds (3 seconds).

Notification Types

  1. NotificationType.Information: Displays an informational message (default).
  2. NotificationType.Success: Displays a success message, usually indicating a successful operation.
  3. NotificationType.Warning: Displays a warning message, usually indicating a caution or potential issue.
  4. NotificationType.Error: Displays an error message, usually indicating that something went wrong.

Notes:

  1. Message Clarity: Ensure that the notification messages are clear and concise to effectively communicate with users.
  2. Notification Duration: Adjust the timeout duration based on the importance and length of the message. Use longer durations for critical messages and shorter ones for less important notifications.
  3. Consistent Styling: Use consistent notification types and styling throughout your app to maintain a uniform user experience.
  4. Form Validation: Use Notify to provide immediate feedback on form validation, such as missing or incorrect fields.
  5. User Guidance: Provide informational messages to guide users through app processes and steps.
  6. Error Handling: Alert users to errors and issues that occur during app operations, such as failed data submissions or invalid inputs.
  7. Success Confirmation: Confirm successful operations, such as data submissions, updates, or deletions.

PowerApps – simple information notification

Suppose you want to display a simple informational notification.

  1. Add a Button Control:
    • Insert a Button control named InfoButton.
    • Set the Text property of the Button to "Show Info".
    • Set the OnSelect property of the Button to:

Notify("This is an informational message.")

When the button is clicked, it will display an informational notification with the message "This is an informational message."

PowerApps – Display a Success Notification

Suppose you want to display a success message when a user submits a form.

  1. Add a Button Control:
    • Insert a Button control named SubmitButton.
    • Set the Text property of the Button to "Submit".
    • Set the OnSelect property of the Button to:

// Assume form submission logic here

Notify("Form submitted successfully!", NotificationType.Success)

When the button is clicked, it will display a success notification with the message "Form submitted successfully!"

PowerApps – Display an Error Notification

Suppose you want to display an error message if a required field is empty.

  1. Add a Text Input Control:
    • Insert a Text Input control named NameInput.
  2. Add a Button Control:
    • Insert a Button control named ValidateButton.
    • Set the Text property of the Button to "Validate".
    • Set the OnSelect property of the Button to:

If(IsBlank(NameInput.Text),

    Notify("Name is required.", NotificationType.Error),

    Notify("Validation successful!", NotificationType.Success)

)

When the button is clicked, it will display an error notification if the NameInput is empty, and a success notification if it is not.

PowerApps – Display a Warning Notification

Suppose you want to warn users if they are about to delete an important record.

  1. Add a Button Control:
    • Insert a Button control named DeleteButton.
    • Set the Text property of the Button to "Delete".
    • Set the OnSelect property of the Button to:

Notify("Are you sure you want to delete this record?", NotificationType.Warning)

When the button is clicked, it will display a warning notification with the message "Are you sure you want to delete this record?"

PowerApps – Notify if form input field is blank

Here’s a comprehensive example that demonstrates using the Notify function to provide feedback during form submission and validation:

  1. Add a Text Input Control for User Name:
    • Insert a Text Input control named NameInput.
    • Set the HintText property to "Enter your name".
  2. Add a Button Control for Submission:
    • Insert a Button control named SubmitButton.
    • Set the Text property of the Button to "Submit".
    • Set the OnSelect property of the Button to:

If(IsBlank(NameInput.Text),

    Notify("Name is required.", NotificationType.Error),

    Notify("Form submitted successfully!", NotificationType.Success)

)

PowerApps – Customize Notification Duration

You can also customize the duration for which the notification is displayed by using the optional Timeout parameter. Here’s how you can do it:

  1. Add a Button Control for Custom Duration Notification:
    • Insert a Button control named CustomDurationButton.
    • Set the Text property of the Button to "Custom Duration".
    • Set the OnSelect property of the Button to:

Notify("This message will be displayed for 5 seconds.", NotificationType.Information, 5000)

This button will display an informational message for 5 seconds (5000 milliseconds).


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint