Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Triggers
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
  • Get help with flow
Menu

Display approval history in a simple, user friendly way via Power Automate

Posted on October 28, 2020May 18, 2021 by Tom

“Is there a way to display approval history in some way that’s easy to read for the users when using Power Automate? Maybe directly in the SP list?”


Using Power Automate, the whole approval history for everything is in one place. Power Automate -> Action items -> Approvals -> History. But I don’t think it’s really user friendly if you need a quick overview, or if you need to share it with other users. It’s much better to keep the approval history directly in the item/document itself, and that’s the goal of this post.

Prerequisite: ‘Multiple lines of text’ column with ‘Enhanced rich text’ enabled to store the history.

Building ‘Approval history’ table

We’ll need a variable dedicated to building the Approval history table, let’s call it ‘ApprovalHistoryTable’. The Approval history table is using HTML elements (that’s why the column has to be enhanced rich text), so during the initialization we can already put the first HTML elements in it. The code below will start the table and add the headers Date, User name, Response and Comments to it.

<table><tr><th>Date</th><th>User name</th><th>Response</th><th>Comments</th></tr>

We can also initialize one more string variable that will be needed later. Let’s call it ‘DateToFormat’ and we’ll use it to format the date in a user readable way.

With this we’re ready to skip a bit in the flow, right after the ‘Approval’ action.

Add ‘Approval history’ line for each step

The ‘Apply to each’ action where you’re processing all the approval ‘Responses’ is our next target.

This is the moment when we’ve got all the information we need for the table. The first step is to store the response date into the ‘DateToFormat’ variable. It is necessary as we can’t apply the formatDateTime() expression on the response date, but we can apply it on a variable.

The second step is to add another line in HTML format to our ‘ApprovalHistoryTable’ using the ‘Append to string variable’ action.

<tr><td>[formatDateTime(variables('DateToFormat'), 'yyyy-MM-dd HH:mm')]</td><td>[Responses Approver name]</td><td>[Responses Approver response]</td><td>[Responses Comments]</td></tr>

Notes:
[formatDateTime(variables(‘DateToFormat’), ‘yyyy-MM-dd HH:mm’)] is an expression using the ‘DateToFormat’ variable, you can format the date/time as you wish. You can find more formatting options in my previous post.
[Responses …] are all dynamic content from the ‘Start and wait for an approval’ action.
[] are used only for graphic representation of the expression and dynamic content, they’re not part of the code.

Update the ‘Approval history’ into the item

Once we have the new lines in ‘ApprovalHistoryTable’ variable, we can update it in the item. You can use either the ‘Update item’ action, or HTTP request to update that single column. Just don’t forget to add </table> at the end to close the table.

The order of the actions that create the approval history table is below.

Summary

I consider the ‘Approval history’ solution described above as a baseline for any approval process. I don’t expect users want to go to the Power Automate application to see approval history. They want to have clear overview right away. And that’s exactly the reason to use this solution. It doesn’t add much complexity to the approval flow, but the benefits I see are huge.

Just keep in mind that the solution above doesn’t describe Approval process implementation, it is only an extension to an Approval process. And be careful about infinite trigger loop with ‘on update’ triggers.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

11 thoughts on “Display approval history in a simple, user friendly way via Power Automate”

  1. Tina says:
    March 22, 2022 at 9:23 pm

    I have a question about the creation of a sharepoint list based specifically on the approval flow triggered by one of the 5 users in my group that send out documents for approvals. We have 20-30 approvers, and their comments that need to be visible to upper management and for compliance reasons.

    Any help would be greatly appreciated! I’m trying to avoid the switch to opentext as we’ve finally got our sharepoint doc library with all it’s metadata organized beautifully!

    Reply
    1. Tom says:
      April 3, 2022 at 7:37 pm

      Hello Tina,
      if you don’t want to keep the history directly in a separate column in the library, you can use the solution described here: https://tomriha.com/how-to-log-approval-history-in-a-sharepoint-list-with-power-automate/

      Reply
  2. Craig Cowley says:
    May 10, 2022 at 9:49 pm

    Hi Tom,

    This is working great for me thanks. I’m thinking that it would be good to have the email addresses of the group of people that need to be assigned to the ‘Start and wait for an approval’ rather than have to add each user (I have a number of approval conditions and each conditions has a different list of people).

    I’ve created my excel file with a table containing a single column of email addresses. I’ve added an action ‘List rows present in table’. in the ‘Start and wait for an approval’, when I add the table name it gets put in an ‘Apply to each’ action.

    Will this mess up my history table?

    Thanks

    Craig

    Reply
    1. Tom says:
      May 15, 2022 at 5:30 pm

      Hello Craig,
      the ‘Apply to each’ is added automatically because the ‘List rows…’ action can return multiple rows (https://tomriha.com/stop-power-automate-flow-from-adding-apply-to-each-automatically/). If that’s what it should do – create a task for each row or it always returns just a single row then it’s fine. It’ll not mess up the history table if you always take the latest value and append the new response (don’t replace it).
      Some time ago I even wrote articles about a similar solution using SharePoint list for the configuration as I don’t like using Excel files: https://tomriha.com/build-approval-flow-for-various-number-of-approvers-in-power-automate/ and https://tomriha.com/use-configuration-lists-to-avoid-repeating-actions-in-power-automate/.

      Reply
      1. Craig Cowley says:
        November 11, 2022 at 3:18 pm

        Hi Tom,

        Apologies for not responding earlier. I have this work great now, thanks. I’ve also moved the flow forward so that the SP list gets populated as ‘Waiting’ whilst the approval cycle happens (I had someone who took 3wks to approve).

        I do have another question, is it possible to format the columns within the ‘Approval history’ sometimes it looks awful, especially if the comment is long.

        Thanks

        Craig

        Reply
        1. Tom says:
          November 13, 2022 at 6:58 pm

          Hello Craig,
          not really, it always has to fit in the width of the history columns. Maybe you could combine it with the approval history in a separate list as described here: https://tomriha.com/how-to-log-approval-history-in-a-sharepoint-list-with-power-automate/ – display some short summary directly in the item + link to the other list with the full information.

          Reply
  3. Alexandru M. says:
    August 29, 2022 at 1:25 pm

    Hello,
    Many thanks on this post, it really helped us.
    The template works very fine for 3 line of approval but if we’re adding another line of approval it will not be seen in the SharePoint list/approvalhistory, the row remain fix only for the first 3 lines.
    Any idea how to raise the raw height?

    Reply
    1. Tom says:
      September 4, 2022 at 7:43 pm

      Hello Alexandru,
      I don’t think you can increase the line height, if it’s more than the current height users will have to click on it to see more lines. Maybe you could reverse it to show the latest approval at the top as it might be more important than the first ones.

      Reply
    2. Dhivya S L says:
      October 25, 2022 at 2:18 pm

      Hi,
      Can you please tell me how you implemented that “Approval steps” variable in your flow ?

      Reply
  4. Dhivya S L says:
    October 25, 2022 at 9:18 am

    Hello,

    The flow worked. Thank You.
    But the approval history is not getting appended for me. Just getting replaced with the recent approval process.

    One doubt here is I’m seeing Apply to each for “Approval steps”. I can understand that “Approval steps” is a variable but how it should be initialized and what should be the value?

    It hasn’t been explained in the step-by-step process in this tutorial but shown in the order of the flow. So, getting confused about it.

    As I have no idea about that step, I didn’t include that in my flow. I think because of that Approval history is not getting appended.

    Kindly guide me with this ASAP.

    Reply
    1. Tom says:
      November 6, 2022 at 7:57 pm

      Hello Dhivya S L,
      if you need help ASAP I’d recommend hiring a consultant.
      The ‘Approval steps’ variable contains the approvals, it can be e.g. a SharePoint list with approval configuration as described here: https://tomriha.com/build-approval-flow-for-various-number-of-approvers-in-power-automate/

      Reply

Leave a Reply Cancel reply

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

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


NEW! Master the HTTP requests to SharePoint with a new cheat sheet!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Use Power Automate to forward Outlook events upon registrationJanuary 29, 2023
  • Why the condition is false for the same numbers (Power Automate)January 25, 2023
  • How to forward event invitation to other calendar (Power Automate)January 22, 2023
  • Run ‘For selected item’ flow from non-default environment (Power Automate)January 18, 2023
  • Hide button in SharePoint list after Power Automate flow startedJanuary 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes