We will learn display the notifications in Canvas App using Power FX Notify() function. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
What is Power FX?
Microsoft’s Power Fx is the low-code language that will be used across Power Platform. It’s a strong-typed, general-purpose, declarative, and functional programming language. Power Fx is expressed in user-friendly text. It’s a low-code language that citizen developers & makers can work with directly in an Excel-like formula bar or Visual Studio Code text window.
It enables a complete range of development from no-code for those who have never programmed before to “pro-code” for the seasoned professional, with no learning or rewriting cliffs in between, enabling diverse teams to collaborate and save time and expense.
Understanding Notify function
Notify(Message [,NotificationType, Timeout]])
The Notify function displays a banner message to the user at the top of the screen, overlaying what is currently displayed. The notification will remain until the user dismisses it, another notification replaces it, or the timeout expires which defaults to 10 seconds.
– Message – Required. Message to display to the user.
– NotificationType – Optional. Type of the message to display from the table above. The default is NotificationType.Information.
– Timeout – Optional. Number of milliseconds to wait before automatically dismissing the notification. The default is 10 seconds (or 10,000 milliseconds). The notification will be displayed indefinitely with a Timeout of 0.
Type of Notifications
Canvas App support four different type of notifications as given below.
NotificationType Argument | Description |
---|---|
NotificationType.Error | Canvas App displays the message as an error. |
NotificationType.Information (Default) | Canvas App displays the message as informational. |
NotificationType.Success | Canvas App displays the message as success. |
NotificationType.Warning | Canvas App displays the message as a warning. |
Examples of Notify Power FX function
Notify( “CRM Crate Error Notification”, NotificationType.Error, 1000)
The above Power FX formula displays an error notification for 1 second.
Notify( “CRM Crate Information Notification”, NotificationType.Information, 1000)
The above Power FX formula displays an informative notification for 1 second.
Notify( “CRM Crate Success Notification”, NotificationType.Success, 1000)
The above Power FX formula displays a success notification for 1 second.
Notify( “CRM Crate Warning Notification”, NotificationType.Warning, 1000 )
The above Power FX formula displays a warning notification for 1 second.
Validating our implementation in Canvas App
The below animation display an output of Notify function in Canvas App.