How to create in-app Notifications with Navigation in Model-driven Apps with Power Automate

Sara LagerquistDyn365CE3 years ago22 Views

Isn’t that title a mouthful? The thing is when you read the microsoft documentation on this feature it’s mostly code instructions apart from how to create a really basic notifications. But what if I don’t want to use JavaScript and still want those fancy pancy navigation links in my notifications? Here is how.

Background

As some of you know I’ve been away for a bit going through treatment for breast cancer (if you want to hear more about it I recorded a podcast with Mark Smith about it). So what do you do when you come back after 10 months away without as much as opening your computer? How do you catch up?

Well I started with looking through the past two release notes I missed and there is especially one function that caught my attention more than others. IN-APP NOTIFICATIONS – say what now?! How long have we wanted something like this to offer to our customers to replace the constant requirement of e-mail notifications (yuck).

Enabling the Preview Feature

So this was part of the wave 1 2021 release notes but it just got released into preview in late august 2021. So note that this is not a feature to use in your implementations just yet, which also probably (hopefully) is why it’s a bit messy to turn the feature on. I followed this excellent blogpost by Chime Okure to turn it on in my environment.

Creating the Notification in Power Automate

Now time for the fun part! Let’s create a notification. I start by using the Dataverse (oh, apparently new name) connector using the trigger “When a row is added, modified or deleted” (Row? Added? It’s a whole new language to me but very well…)

Define when you want to trigger a notification, in my example I simply choose to send a notification to the Account Owner when an Opportunity is created on that Account. Next add a Dataverse action called “Add a new row” and choose the Notifications table.

Note that there are several tables called Notifications and you want to use the one called appnotifications.

Here you have a screenshot from Microsoft’s documentation about the table and what information you should populate in the action. If I just choose Title, Owner and Body I’m left with a simple notification but let’s focus on the Data column for a bit.

Creating a JSON for the Data column

In the data column you can define if you want

  • one or several Navigation links
  • if the navigation link(s) should open a row or a view
  • if the navigation link(s) should open in a dialog, current page or in a new tab

Doesn’t that sound awesome?

Target choice

First I want to make you aware of the “navigationTarget” property that we will define in the JSON.

My examples will open the record navigation links in a dialog and my view navigation links “inline”. This is because you get an unpleasant error if you try to open a view in dialog (I was tearing my hair out figuring that out and that is saying a lot since I’m really not keen on going bald again like during chemo.)

JSON for one Navigation Link opening a row

The most straight forward notification is to open a specific record that the notification is about. It could look something like this:

Take this JSON below and copy and paste it into your data column. Change title, table and add dynamic content (record id) marked in red. It’s the “pagetype=entityrecord” that defines that it is a row and not a view.

     {
  "actions": [
        {
        "title": "Display title of Navigation link",
        "data": {
            "url": "?pagetype=entityrecord&etn=<TABLE>&id=<Dynamic content>",
            "navigationTarget": "dialog"
               }        
        }
      ]
     }

This is how it looks in my action

JSON with one Navigation link opening a View

Now another common use case would be to have a link to a view in the notification. In this example I trigger on an new Opportunity but the navigation will take the user to a view with all Open Opportunities.

Let’s take the same JSON object as above and change pagetype to “entitylist” and add “view” as shown here in bold.

     {
  "actions": [
        {
        "title": "Display title of Navigation link",
        "data": {
            "url": "?pagetype=entitylist&etn=<TABLE>&viewid=<Dynamic content>",
            "navigationTarget": "inline"
               }        
        }
      ]
     }

Again: Note that a VIEW link will NOT work with navigationTarget “dialog”. 🤦‍♀️

This is what my action looks like:

Ran into some funny business finding that view ID too, so new blog post about that coming later this week but in short it’s the same principle as getting the record ID.

JSON with several Navigation links

Sometimes you might want several navigation links in the notification. In my example below I’ve chosen a link to both the relevant Account and the relevant Opportunity.

The result of two actions in the same JSON. PRETTY!

What you do to accomplish this is really just duplicate that part of the JSON (bold part below) and update with the accurate entity/table name, dynamic content and title.


 {
  "actions": [
        {
        "title": "Display title of Navigation link",
        "data": {
            "url": "?pagetype=entityrecord&etn=<TABLE>&id=<Dynamic content>",
            "navigationTarget": "dialog"
               }        
        }
      ]
     },
	    {
	      "title": "Display title of Navigation link 2",
        "data": {
		    "url": "?pagetype=entityrecord&etn=<TABLE>&id=<Dynamic content>",
		    "navigationTarget": "dialog"
	        }
	    }
	 ]
}

This is how it looks in my action:

There is such a thing as TOO MANY ACTIONS

Be careful, for your users sake, and don’t abuse this by putting to many actions in the same notification because it looks messy to say the least. Yikes.

Summary

Okay folks. Don’t forget that this is a preview feature and much can happen until it comes out in GA. This might not be the best way to use this function then. Only time will tell!

That was fun writing but totally exhausting too. Time for my nap. Ciao!

Original Post https://saralagerquist.com/2021/09/21/how-to-create-in-app-notifications-with-navigation-in-model-driven-apps-with-power-automate/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...