Power Automate Approvals – Markdown or HTML?

If you have ever used a Power Automate (formerly Microsoft Flow) Approval action, you probably know the struggle of getting the body of the mail look great. Markdown isn’t only a terrible way of styling the details of your approval, it also doesn’t support all of the elements you may want to use.

So, are we to accept this way of working, or is there another way? In this blog post, I will tell you how you can do this differently.

Markdown

First of all, let me explain the basics of markdown language.
It is supposed to be an ‘easy-to-read, easy-to-write’ plain text format, but that depends on what you are used to write. Some of us (like me), coming from earlier workflow solutions, are more known with RTF or HTML.

Markdown will let you write basic syntax and after ‘compiling’ it will automatically convert to an (X)HTML format for you. That way, you don’t need to know the HTML coding principles.

An example:

In HTML, a header is defined by using <h1>This is my header</h1>. In markdown, the same header is defined by using #This is my header#.

More information about the markdown language syntax can be found here.

Now, is this a true problem for all users using Approvals? Ofcourse it isn’t, but markdown (and especially the approval action itself) does limit you in the way your approval is sent out.

First: the approval action is always in the same format. You can’t style the overall feeling (e.g. apply company branding) of the notification mail that will be sent.

Second: you can’t use certain elements that HTML does allow you to use, like CSS or JavaScript. This is more of a lack for the ‘advanced’ user.

On the other hand, since the approval action uses an actionable message, you can handle the approval request entirely from your mail client which makes it quite powerful.

Note: actionable messages are only supported in Outlook 2016, Outlook 2019 and Outlook Online. If you are using another mail client, you will get a ‘plain’ e-mail message with link buttons to the flow approval portal.

HTML

So, are we condemned to using markdown language for all of our approval actions? The answer is simple: no!
You can still define your own HTML formatted message and use links to the corresponding approval item in the approval portal.

An example:

The above example is just a simple example. You don’t really need to alter from markdown to HTML if you use such a basic format, but it shows you the basics of having an HTML mail with links that immediately redirects you to the corresponding approval item and even selects the output for you.

Imagine using your company branded mail body instead of this basic example. Wouldn’t that be awesome?!

Using HTML instead of markdown

First of all, you need to know which approval action you should use. There are 3 actions within the Approvals connector:

You need the ‘Create an approval‘, combined with the ‘Wait for an approval‘ action. If you use the ‘Start and wait for an approval‘, your flow will halt at that action until the response is given, which will not allow you to send an e-mail after this action.

Within the Create an approval action, you will configure it as you always do (maybe with a little bit less info in the Details section, because you can provide that information in the HTML mail and some basic information in this section). After you have configured your approval, make sure you disable sending a notification to the approver(s)! Otherwise, the default approval mail will still be sent to the approver(s).
You can do this by setting the Enable notifications option (below Show advanced options) to No.

After configuring the approval action, we can send out our own customized approval mail. But first, we need to build our approve/reject URLs. You can also do this directly into your Send an email action, but I prefer to separate such actions, so I built the URLs inside separate Compose actions.

The URL consists of the following:

  • Path to the Approval Portal, which is ‘https://flow.microsoft.com/manage/approvals/received/
  • The ID of the approval item, which can be pulled from the Dynamic Content attribute ‘Approval ID
  • The response you want to give (optional), which is ‘Approve‘ or ‘Reject

If you put these 3 elements together using the concat() expression (with the Expression builder), you will get the following expressions:

Approve
concat(
	'https://flow.microsoft.com/manage/approvals/received/',
	body('Create_an_approval')?['name'],
	'?response=%27Approve%27'
)
Reject
concat(
	'https://flow.microsoft.com/manage/approvals/received/',
	body('Create_an_approval')?['name'],
	'?response=%27Reject%27'
)

Now that we have the URLs, we can put together the approval mail. You’re completely free to use whatever you want. You can use the default RTF builder or write your own HTML. You only need to make sure to use the URLs generated above for the Approve and Reject buttons. You can even set the importance and/or choose if you want to send the mail from a shared mailbox. Isn’t that convenient?

After that, you need to add the Wait for an approval action and add the Approval ID attribute from the Dynamic Content to the Approval ID field. With that in place, you can configure your flow further as you always do: configuring a condition that will check the outcome of your Wait for an approval action for a specific outcome (Approve/Reject) and do whatever you want to do next!

Final thoughts

If you’re happy with the way markdown works or not looking for another way of styling your approval requests, you can stick with the markdown language within your approval actions. But if you want to go just a little bit further with the possibilities of styling your approval requests, you can consider the method I described above.
Please do keep in mind that if you alter from the default approval notification to a self-generated e-mail, you will loose the ability to directly handle your approval request from out your mail client.

16 Replies to “Power Automate Approvals – Markdown or HTML?”

  1. You rule. Thank you. I combined this with another flow I found that includes a reminder option and it all works perfectly.

    1
    0
      1. Cool stuff but I cannot get my links at the bottom of the page to work. I have tried several different ways of adding the Approval ID. This is the result after coping your code directly into my Compose inputs.

        Approve:
        Concat(‘https://flow.microsoft.com/manage/approvals/received/’,body(‘Create_an_approval’)?[‘name’],’?response=%27Approve%27′)
        Approve Result:
        https://flow.microsoft.com/manage/approvals/received/f589e68d-22d1-4554-9a24-cb0755c1900d?response=%27Approve%27

        Reject:
        concat(‘https://flow.microsoft.com/manage/approvals/received/’,body(‘Create_an_approval’)?[‘name’],’?response=%27Reject%27′)
        Result Result:
        https://flow.microsoft.com/manage/approvals/received/f589e68d-22d1-4554-9a24-cb0755c1900d?response=%27Reject%27

        0
        0
              1. I found my issue. I am working for the government and the URL is slightly different with .gov in the url. Now it works and it’s is brilliant! I am so happy to have found this solution as my email formatting is so much better.

                I did need a second approval which created some additional complexity. I had to create a second Approval2 ID and a second approval2 and reject2 which now works great.

                My only add is I do a Compose Email in the beginning of my flow and create my email with the variables. Then in my actual email I call that Compose. But I had to add the Approve & Reject variables to each email separately as they have different Approval ID’s for each.

                Thank you again!

                0
                0
  2. This great, I am having one issue, When I add approve or reject to the sting when it goes in approval site instead of filling in my option it says something when wrong.
    concat(‘https://flow.microsoft.com/manage/approvals/received/’, outputs(‘Create_an_approval’)?[‘body/name’],’Approved’)

    0
    0
  3. Hey Rik,

    This is really good. Only thing i ran into is, it is always taking me to the flow and ask me to approve instead of defaulting to approve when i click on approve link? can you advice what i have to do to get it right?

    0
    0

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.