Power Automate Approvals Attachments With Dataverse Files
![Power Automate Approvals Attachments With Dataverse Files](https://www.matthewdevaney.com/wp-content/uploads/2024/08/powerautomate-dataverseapprovalattachments-0.jpg)
Power Automate approval flows can include attachments from Dataverse file columns file attachments. The approver is able to open the file and review it before choosing to approve or reject it. File columns and attachments lists must be handled different ways in an approval flow. I will show you both methods and provide templates you can use when building your own flows
Table of Contents
• Introduction: The Approval Flow With Dataverse Attachments
Dataverse File Column Approval Attachments
• Create A Dataverse Record With A File
• Add Dataverse File Column To An Approval Action
• Run The Approval Flow With File Column Attachments
Dataverse Notes Table Approval Attachments
• Create A Dataverse Record With Notes & Attachments
• Add Dataverse Attachments Files To An Approval Action
• Run The Approval Flow With Dataverse File Attachments
Introduction: The Approval Flow With Dataverse Attachments
The finance department uses Power Automate approval flows to approve invoices and expenses. The approval attachments can come from a Dataverse table file column or the attachments.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-11-1024x534.jpg)
Dataverse File Column Approval Attachments
Create A Dataverse Record With A File
Open Power Apps and create a new table named Invoice Approvals. Add a file type column called Invoice File.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-2.jpg)
Insert the Invoice File field into the main form. Create a new record in the table and add a invoice to the field.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-1.jpg)
Add Dataverse File Column To An Approval Action
Go to Power Automate and start a new automated flow with the Dataverse – When a row is added, modified or deleted trigger. The trigger returns only a limited set of fields from the record so we must get a row by id to obtain the full details. Then we download the invoice from the file field so we can use its file content inside of the Create Approval action.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-5.png)
Use this code in the Attachment Name field of the Create Approval action. It will display the full file name and extension in the approval.
body('Get_a_row_by_ID')?['md_invoicefile_name']
Run The Approval Flow With File Column Attachments
That’s all it takes to build the Power Automate approval flow with a file column attachment. Save the flow and add a new file to the library to see it run.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-7.jpg)
The approval action now includes a document file from Dataverse.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-6.jpg)
Dataverse Notes Table Approval Attachments
Create A Dataverse Record With Notes & Attachments
Go to Power Apps and create a new table named Supplier Expenses. Enable attachments for the table.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-4-1024x702.jpg)
Add a timeline control into the main form. Insert several new notes with an attachment into a supplier invoice record.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-3-1024x703.jpg)
Add Dataverse Attachments Files To An Approval Action
Start a new Power Automate flow with a Dataverse – When a row is added, modified or deleted trigger. List all of the rows from the Dataverse Notes table with an object id value matching the flow trigger id. Then for each notes record, check if it is an attachment and compose an attachment object to include in the approval. Add a create approval action, switch the approvals input fields to entire array and reference the compose action inside of the apply to each loop.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-8.png)
Filter the Notes table by using this odata query in the list rows action
_objectid_value eq @{triggerOutputs()?['body/md_supplierinvoiceid']}
Compose the attachment object using this code.
{
"name": "@{items('Apply_to_each:_Note')?['filename']}",
"content": {
"$content-type": "application/octet-stream",
"$content": "@{items('Apply_to_each:_Note')?['documentbody']}"
}
}
Include this flow expression in the attachment field of the create approval action
outputs('Compose:_Attachment')
Run The Approval Flow With Dataverse File Attachments
Save the flow and modify the record with multiple attachments to see it run.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-10.jpg)
The flow approval appears with multiple attachments from the Dataverse record.
![](https://www.matthewdevaney.com/wp-content/uploads/2024/06/powerautomate-dataverseapprovalattachments-9.jpg)
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 Approvals Attachments With Dataverse Files 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.
Great article as always, thanks Matthew! I always have a little difficult to understand how compose action works inside an Apply to Each function, it actually composes and appends to an array at the same time. Do you know if MS has any official document explained about this behavior?
I’ve done something similar, except the file wasn’t used in an approval but sent for digital signing.
Because my case always had a single file, I filtered the notes attachments (list rows) by ‘isdocument = true’, sorted by date and added a row limit of 1,so only the newest note would be returned.
That saved me unnecessary calls and allowed to use first() on the array to avoid having to use a loop.