top of page
Neon Smoke
Writer's pictureAngeliki Patsiavou

Power Automate Emails - Dynamics 365

Updated: Oct 7

Like a modern Alice in Power Platform Wonderland, I decided to explore a few different aspects of sending emails through Power Automate in the last few days. Soon enough, unsurprisingly, I went down some interesting rabbit holes.


As a former Marketing Manager using multiple enterprise marketing platforms in her lifetime to send emails, this experimentation was bound to happen. Automation is at the core of optimizing business processes, and I had an app that was prime for it. And, surprise surprise, this time the app was not movie-themed.


What did she just say? At this point, let me reassure you I am still ok, have no fever and my pulse is thriving.


Explaining the use case – one ticking clock at a time

This intro would not be complete without explaining the use case. It is something familiar to many of us working with Dynamics 365 or Model-Driven Apps.


Allow me to summarize in a few bullets the general use case:

  • We have a Dynamics 365 app used by public sector officers processing applications, applicant profiles, legal activities, interviews, screening officers’ profiles and so forth.

  • A business process flow guides screening officers through the steps they need to follow, data to fill in, and supporting information to chase.

  • The final step before the applications’ outcome is reached is an approval stage, where a chief inspector reviews the application and determines the outcome.


Nothing surprising so far, this is one of the things Dynamics 365 apps do best.


With regards to the approval stage and workflows, also some great OOTB features out there. Let’s also summarize what was used in this case:

  • Once the process reaches the approvals stage, the application is assigned through automation to the Chief inspector who needs to be notified for the review required.

  • Once the Chief Inspector has completed their review, only they can fill in the column-level security protected Approver Decision field and move the application to the next stage.


Wonder which way I ought to go – Lessons from the Power Automate rabbit hole

Building the email automation should be easy right? In theory yes, but it did get interesting when I became curiouser and curiouser. Here is what I learned (or convinced myself even further on):

  • Trigger conditions are like a best, most flexible friend: Whilst Filter rows queries work, I find writing JSON so much easier when it comes to more complex queries. One thing to note when it comes to columns like data types like Choice ones, remember the difference between the label and the value when you type your query. Otherwise, it will  not work and trigger every time e.g. when you modify a record.

  • Get a row by ID can come in handy: This is the intermediary action to many steps where we need the GUID of the record. In this case, we will conjure up some magic with it to redirect to the record itself.

  • Dynamic content is key to personalization: Now this one is a key recipe since my Marketing days. You can use data from the table you are referencing in your trigger ANYWHERE to make your email stand out. This includes both the Subject and the Body. The Subject Line is particularly helpful to capture the recipient’s attention among their mailbox’s abyss!

  • Direct link to the Dynamics 365 record: There is out-of-the-box functionality to customize the text e.g. bolding, font, bulleting, even adding a hyperlink. However, how do we add a dynamic hyperlink to the Dynamics 365 record the Power Automate flow was triggered from? Someone's head will roll for this!

One school of thought would be, can we use the Link button like we would in a Word document? Sadly no, because we need a dynamic link adjusting to the record’s unique GUID each time with Dynamic Content. This is not accessible through that feature, so a no go.

That being said, we have another door (or potion bottle) to choose. Enter Code View! This helps you switch your existing body content to an HTML view and thus add all sorts of special tricks.

We want to be able to have a clickable hyperlink e.g. the classic click here approach. To do that, we click on Code View first and then add something similar to the below.

Let’s unpack some HTML essentials you have to change yourself:

  • Href: We want a clickable hyperlink, leave as is.

  • https://org...com: This is your environment link that you can get off your wider web app link anytime you open a record.

  • Fadf9…: This is your App ID which you can also get from your wider web app link anytime you open a record (between appid= and &pagetype).

  • cr896_application: The logical name of the table that the record is meant to be in, as indicated by your trigger and Get a row by ID step.

  • Application: This is from the Dynamic Content with the table in question. We use that too.

  • clicking here: this is the text for our clickable hyperlink. It makes our email body more interactive and aligned to traditional email practices.

 

5)      From (Send as) do’s and don’ts: Now, whilst it is not a problem to choose any email address for recipients (directs, CC or BCC), the From field is as enigmatic as Alice’s talking rabbit.

If I had a world of my own, everything would be nonsense.

Let’s make it less complex, here are your options:

  • Your own email address in the tenant

  • A shared mailbox you have been given “Send as” permissions for in the Microsoft 365 admin center

  • A user’s mailbox that you have been given “Send as” permissions for in the Microsoft 365 admin center


 

Everything's got a moral, if only you can find it.

We have gone down this fun rabbit hole of musings. How will it all look like? Well, feast your curious eyes on the below.

  1. Personalized email address for the email sender, with the appropriate shared mailbox settings and permissions.

  2. Dynamic content retrieving data from Dynamics 365 to enhance the email experience by making it more informative.

  3. Direct deep link to the Dynamics 365 record which needs to be reviewed for speedier processing. Noice!


Why, sometimes I've believed as many as six impossible things before breakfast.


Or in this case, a minimum of 3!

 

125 views0 comments

Comments


bottom of page