---
source_url: https://itmustbecode.com/enable-model-driven-in-app-notifications-with-power-automate/
title: Enable Model-Driven In-App Notifications with Power Automate
date: 2021-08-29T20:45:22+00:00
categories:
  - blog
tags:
  - dataverse
  - in-app-notifications
  - power-automate
word_count: 573
reading_time_minutes: 3
type: posts
---

**In-App notifications** for PowerPlatform model-driven apps has been released in public preview ( _see official Microsoft blog post below_). I am particularly excited about this new feature as it opens up very interesting scenarios that can have a significant impact on the user experience.

{{< figure src="https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/media/app-notification-with-single-action.png" alt="App notification with single action" caption="App notification with single action" >}}
{{< linkcard url="https://powerapps.microsoft.com/en-us/blog/announcing-public-preview-for-in-app-notifications-for-model-driven-apps/" title="Announcing public preview for in-app notifications in model-driven apps" summary="With this public preview, notifications can be send to users within the model-driven app and are displayed using a notification center and notification toasts." image="https://powerapps.microsoft.com/images/shared/social/social-share-post-ignite.png" domain="powerapps.microsoft.com" new_tab="true" nofollow="true" >}}

Before you can start flooding your users with all those cool notifications, since its a **preview**, the very first action to take is to **enable** the feature at the **app-level**.

It is not possible to enable the feature in the user interface of the Maker Portal. Therefore we need to rely on some **coding magic** to make things happen. In this case, the official documentation suggest sending a JavaScript command using the browser console.

{{< figure src="./image-4.png" alt="" caption="" >}}

> _Keep in mind that the feature will most probably be enabled by default in the future and we won't have to execute the command at all._

What this code does is simply calling an out-of-the-box **action** called **SaveSettingValue**, and setting a parameter called **AllowNotificationsEarlyAccess** to true.


{{< linkcard url="https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/savesettingvalue?view=dynamics-ce-odata-9?WT.mc_id=DX-MVP-5004959" title="SaveSettingValue Action (Microsoft.Dynamics.CRM)" summary="Creates or updates app/organization level override." image="/linkcards/f69ad1e3eed32c06.png" domain="docs.microsoft.com" new_tab="true" nofollow="true" >}}

Not very complicated but also not very citizen-friendly either 🤷.

## **Enable In-App notifications with a Flow**

Let's see how we can use a very simple **Power Automate Flow** to achieve the same result. That way, we can have a **centralized** and **generic** way to enable and disable in-app notifications in **any** model-driven app of an environment.

### 1️⃣ **Setup the Trigger**

For the example, I will make use of the **Manual Trigger** for the Flow.

{{< figure src="./image-11.png" alt="" caption="" >}}

Since I want the Flow to be generic and reusable, there will be 2 input values that we will expect to receive from the caller of the Flow.

1. **AppUniqueName**(string) : This is the uniquename of your model-driven app
1. **AllowNotification**(yes/no) : switch to enable ✔️ or disable ❌ the feature

{{< figure src="./image-13.png" alt="" caption="" >}}

### 2️⃣ **Call SetSettingValue Action**

To call this action we will use the **Perform Unbound Action** step of the **Dataverse** connector.

{{< figure src="./image-12.png" alt="" caption="" >}}

Choose the **SaveSettingValue** action from the dropdown list and map the **AppUniqueName** and **Value** parameters to the corresponding Inputs received from the trigger. The **SettingName** can be hardcoded to ' **AllowNotificationsEarlyAccess**'.

{{< figure src="./image-15.png" alt="" caption="" >}}

### 3️⃣ **Run the Flow**

Now you just need to run your Flow to enable and/or disable the feature in any model-driven app deployed in your environment.

Just pass the **AppUniqueName** and **AllowNotification**(true/false) input parameters.

{{< figure src="./image-9.png" alt="" caption="" >}}

After you run the Flow, you will still need tomanually **publish** your app in the maker portal. Once published, log in to your app and you will see a 🔔 **bell icon** on the top ribbon. Clicking on this icon will pop-up the **notification center** of the logged-in user.

{{< figure src="./image-10.png" alt="" caption="" >}}

{{< figure src="./image-8.png" alt="" caption="" >}}

That's all there is, you can now start to send **In-App notifications** to your users, see the link below for some examples.

I will surely explore the possibilities in future blog post and I'm very curious to see how developers will make use of this **shiny new toy** **✨**.

You can download and import the Flow I used in the example here :

> **Note:** The Flow export file is no longer available for download.


{{< linkcard url="https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/send-in-app-notifications?WT.mc_id=DX-MVP-5004959" title="Send in-app notifications within model-driven apps - Power Apps" summary="Learn how to configure notifications in model-driven apps by using a client API." image="/linkcards/f69ad1e3eed32c06.png" domain="docs.microsoft.com" new_tab="true" nofollow="true" >}}

Photo by [Chris Leipelt](https://unsplash.com/@cleipelt?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/control?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

