How to use PowerApps notify function

Power Apps Notify function helps to display a notification message to the end-user on the Power apps screen. The Power apps notification message will appear either until you disclose it or the timeout expires.


The default time of PowerApps notify function is 10 seconds. That means, By default, the notification message will appear until 10 seconds, after that it will dismiss automatically. Also, you can increase the notification time out in the Notify function.


PowerApps Notify function always returns as true. Previously the Notify function name was ShowError where it was only displaying the error messages.


Power Apps Notify Function Syntax


Below represents the PowerApps Notify Function Syntax:

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

Where,

  • Notify = This is the function that helps to display a notification on the Power apps screen.

  • Message = You must need to specify a message that will display to the user.

  • NotificationType = This is the second argument of this notify function that specifies the type of message to display. The type of message in sense either it can be a success message, an informational message, a warning message, or an error message.

  • Timeout = It is optional. It defines the time to wait before automatically disappear the notification message. The time is in the form of a number of milliseconds.


The default time is 10 seconds or 10,000 milliseconds. After 10 seconds, the message will disappear from the Powerapps screen. With the Timeout of “0”, the notification message will display indefinite time.

Depending upon the type of the notification messages, it changes the specific color and icon. That means, if you are displaying an error message, then it will show the red color with an error icon on the Powerapps screen.


Different Types of NotificationType in Power Apps Notify Function


There are four different types of PowerApps Notification type arguments which are known as the second argument of the Notify function. Such as:

  • NotificationType.Success: This notification argument specifies the message is a success notification message.

  • NotificationType.Information (Default): It is the default argument that specifies the display message is an informational notification. That means, if the user will not specify the second argument, then by default, it will take as an informational message.

  • NotificationType.Warning: This notification argument specifies the display message is a warning message.

  • NotificationType.Error: This notification argument specifies the display message is an error message.


Examples:

By taking a simple example, I will show you how you can use these below four types of Notification on the Power Apps screen.


NotificationType.Success

In this example, a success notification message will appear when the record will submit successfully.

In this below screenshot, there will be a Submit button in the Powerapps form. We need to apply this below formula on the button’s OnSelect property as:

OnSelect = Notify("Event Registration Form Submitted Successfully", NotificationType.Success, 2000)

Where,

  • Notify = It is a function to create the Powerapps notification

  • Event Registration Form Submitted Successfully = It is the message that will display to the user when the record is submitted successfully.

  • NotificationType.Success = It is the notification argument that will display a successful message.

  • 2000 (in milliseconds) = Till 2 seconds, the success notification message will appear on the Powerapps screen.


You can refer the below screenshot:



When you will Preview and Submit the record, then the success notification message will appear as like the below screenshot:




NotificationType.Information (Default)

In this example, an important information notification message will appear when the user doesn’t submit an important document.


In this below screenshot, there will be a Submit button in the Powerapps form. We need to apply this below formula on the button’s OnSelect property as:

OnSelect = If(Checkbox1.Value=false,Notify("Please submit your all documents before 30th June 2020.",NotificationType.Information, 5000))

Where,

  • Checkbox1.Value = It is the checkbox to select it when the user submits an important document.

  • Please submit your document before 30th June 2020 = It is the informational message that will appear when a user does not submit the document.

  • NotificationType.Information = It is the notification argument that will display an informational message.

  • 5000 (in milliseconds) = Till 5 seconds, the informational notification message will appear on the Powerapps screen.

You can refer the below screenshot:




When you will Preview and Submit the record without unchecking the checkbox, then the information notification message will appear as like the below screenshot:




NotificationType.Warning

In this example, a warning notification message will appear when the user enters the Mobile Number less than 10 digits.


We need to apply this below formula on the button’s OnSelect property as:

OnSelect = If(Len(DataCardValue22.Text)<10,Notify("Mobile Number maximum length should be 10",NotificationType.Warning))

Where,

  • Len = It is the length function

  • (DataCardValue22.Text)<10 = It is the Mobile Number Data card field value and it specifies it should be greater than 10 digits

  • Mobile Number maximum length should be 10 = If the user will not enter the 10 digits mobile number, then this warning notification message will display on the Powerapps screen.

  • NotificationType.Warning = It is the notification argument that will display a warning message.

You can refer the below screenshot:



When you will Preview and Submit the record without 10 digits mobile number, then this below warning notification message will appear as:




NotificationType.Error

In this example, an Error notification message will appear when the user enters the Text value instead of the Number in the ZipCode field.


Apply this below formula on the button’s OnSelect property as:

OnSelect = If (!IsNumeric(DataCardValue23.Text),Notify("Please enter valid ZipCode Number",NotificationType.Error))

Where,

  • IsNumeric = it is the numeric function

  • DataCardValue23.Text = It is the ZipCode Data card field value

  • Please enter valid ZipCode Number = It is the error message that will display when the user enters text in the ZipCode field.

  • NotificationType.Error = It is the notification argument that will display an error message.

Refer the below screenshot:



When you will Preview and Submit the record with entering the Text in ZipCode field, then this below error notification message will appear as:




Power Apps Notify Font Size

Every PowerApps Users may want to make the Notify text size bigger when they are using the Notify function. In the PowerApps Notify function, the default size is a bit small and people would like to make it more readily readable.


But unfortunately, there is no way to achieve this notify font size in PowerApps. Ultimately, you can do this thing by using the current Web Browser or Mobile Device.


If you want to make this Notify function text size bigger, then you need to change the Font Size settings in your Web Browser or Mobile Device as shown in the below screenshot.




Power Apps Notify Auto Close

When a user wants to disappear the notification message automatically from the PowerApps screen, then, in this case, we can provide a Timer value (in Millisecond) in the formula.


Also, if you will not provide any timer option to the formula, then by default, it will take 10 seconds and disappear the notification from the screen. Below is the syntax:

OnSelect = Notify("Text to display", Type off notification, 2000)

Where,

  • OnSelect = Button property

  • Notify = Function to create the Notification message

  • Type off notification = It is the notification type argument (like NotificationType.Success, NotificationType.Information etc.)

  • 2000 = Timer value that represents in a millisecond. After 2 seconds, the notification message will dismiss automatically from the Powerapps screen.


In this Power Apps Tutorial, We discussed what is PowerApps Notify Function and its syntax. Also, We saw what are the different types of Power apps NotificationType Arguments and its uses in PowerApps Forms.



Source: SP Guide


The Tech Platform

www.thetechplatform.com

0 comments