Power Automate Approval History For SharePoint Files & Items
Logging the Power Automate approval history for a specific SharePoint file or list item is helpful for auditing purposes. We can show a timeline of events for the document, who approved the document and when they approved it. Then we can record the Approval ID to refer back to the Dataverse Approvals table for more information and also create a hyperlink back to the original flow fun.
Table of Contents
• Introduction: The SharePoint Document Approval History
• Setup The SharePoint Document Library
• Build A Power Automate Flow To Capture The Approval History
• Run The Power Automate Flow To Record The Approval History
Introduction: The SharePoint Document Approval History
Managers at a pharmacy use Power Automate to get approval for invoice payments. Once the approval is completed the approval history is logged alongside the document in SharePoint including a timeline of events.
Setup The SharePoint Document Library
Create a new SharePoint document library named Invoice Approvals with the following columns
- Name
- Approval Outcome (single line of text)
- Request Date (date only)
- Completion Date (date only)
- Approval History (multiple lines of text)
- Approval ID (single line of text)
- Flow Run (single line of text)
Build A Power Automate Flow To Capture The Approval History
Open Power Automate and create a new automated flow. Trigger the flow when a file is created in the Invoice Approvals document library. Add an Approvals – Start and Wait For An Approval action to ask for an invoice approval and collect the response. Then insert a SharePoint – Update File Properties action to write the approval history information to the document properties.
The Approval History is output as multiple lines of text value that includes approver names, the approver response, the request date and the response date.
An Approval ID that holds the unique identifier for the Dataverse Approvals table record is also stored in the file metadata.
Use this expression in the Flow Run field to create a URL that navigates back to the original flow run. Keep in mind the flow run history in Power Automate is only retained for 30 days.
The flow run field is a single line text type but we could also create a clickable hyperlink field in Power Automate with a few extra steps.
https://make.powerautomate.com/environments/@{workflow()?['tags']?['environmentName']}/flows/@{workflow()?['name']
}/runs/@{workflow()?['run']?['name']
}
Run The Power Automate Flow To Record The Approval History
We’re done. Add a new file to the SharePoint document library to test the flow.
Once the invoice is approved or rejected the approval history is written back to the SharePoint document library metadata.
And the Approval ID can be used to lookup more information about the approval in the Dataverse Approvals table.
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
Questions?
If you have any questions or feedback about Power Automate Approval History For SharePoint Files & Items please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
Matthew
i just came across your blog and subscribed – amazing stuff.
May I ask you a question on a slightly different topic?
I want to send an email I compose in outlook to sharepoint and have a news post generated using the subject and body. Is that feasible? The MSFT answers don’t work and you’re my last hope! Gladly contribute to the cat fund with your help!!!
Hi Matthew,
Thanks for sharing the tips on this topic, which is really good. If I’m using the built in request sign off flow, how can I record the approval history (e.g. approver, request date, response date etc) within the file metadata? I can create a separate flow to track the dates but not sure where to start with recording approver. I understand that request sign off flow can’t be modified. I’d be extremely grateful for your suggestion. Thank you.
best wishes
S