Microsoft has introduced a new in-app notification feature which is now generally available as part of the 2022 Release Wave 1 for Dynamics 365.
This app notification feature allows the model driven app to pop notifications for specific users .
In-app notifications uses polling to retrieve notifications periodically when the app is running. New notification are retreived at start of the model-driven app and when a page navigation occurs as long as the last retreival is more than one minute ago. If a user stays on a page for a long duration, new notifications will be retrieved.
Notification can be triggered within the dynamics CRM or from external system using java script , plugin ,WEB API , Power automate .All the notifications for a specific user are visible under model driven apps in app notification center.
To know more about the In app Notifications refer to this link In app Notification.
Below I will demonstrate how to send in app notification using power automate to a user when a case is assigned to him
First we have to enable the app notification in model driven app. Add your model driven app in a solution and open the editor.
Click on settings > Features > turn on in app Notification
Now we have enabled in app notifications for the model driven app.
Next step is to create a power automate . Open https://make.powerapps.com/ and create a new automated cloud flow.
Select the dataverse trigger when a row is added , modified or deleted .
I have configured the trigger on change of ownerid that is whenever a case is assigned to a user.
Next step is to initialize a variable to be passed as json.
{
"actions": [
{
"title": "View Case",
"data": {
"url": "?pagetype=entityrecord&etn=incident&id=@{triggerOutputs()?['body/incidentid']}",
"navigationTarget": "dialog"
}
}
]
}
The above json defined the behavior of the notification.
Title – Value used for tittle will be displayed as a hyper link to be clicked on in notification.
URL – Url to which the notification button will navigate to . I am using the case entity record id with parameters to navigate to case form.
navigationTarget – You can control where a navigation link opens by setting the navigationTarget
parameter.
Navigation target | Behavior | Example |
---|---|---|
dialog |
Opens in the center dialog. | "navigationTarget": "dialog" |
inline |
Default. Opens in the current page. | "navigationTarget": "inline" |
newWindow |
Opens in a new browser tab. | "navigationTarget": "newWindow" |
Next step is to parse this json string using compose .
We will use the dynamic content to parse the string in to json .
Next step is to create a record in app notification table .
The following are the columns for the Notification (appnotification
) table.
Column display | Column name | Description |
---|---|---|
Title | title |
The title of the notification. |
Owner | ownerid |
The user who receives the notification. |
Body | body |
Details about the notification. |
IconType | icontype |
The list of predefined icons. The default value is Info . For more information, go to Changing the notification icon later in this topic. |
Toast Type | toasttype |
The list of notification behaviors. The default value is Timed . For more information, go to Changing the notification behavior later in this topic. |
Expiry (seconds) | ttlinseconds |
The number of seconds from when the notification should be deleted if not already dismissed. |
Data | data |
JSON that’s used for extensibility and parsing richer data into the notification. The maximum length is 5,000 characters. |
I have assigned values to required entity fields as shown in above screenshot .
I have assigned the owner as the user to whom the case is assigned.
Our notification setup is ready to be tested , Lets assign a case to my user and check .
When we click on the View case button a dialog pop up with the case form will open.
Hope this Helps !!
Original Post https://msdynamicscrm137374033.wordpress.com/2022/09/11/send-in-app-notification-in-model-driven-app-from-power-automate/