How to Send an Approval Request With an Attachment Using Power Automate?

While working on a leave request application, I needed to send an approval request with an attachment to the approver. The approver should be able to open the file and review it before choosing to approve or reject it.

In this tutorial, I will explain how to send an approval request with an attachment using Power Automate.

Send an Approval Request With an Attachment Using Power Automate

I created a SharePoint list using the below column and data types for this example.

ColumnsData Types
Employee IDSingle line of text (Title)
Employee NamePerson or Group
Leave TypeChoice
Start DateDate and time
End DateDate and time
Reason for LeaveMultiple lines of text
ManagerPerson or Group
Power Automate create approval flows with attachments

Here, I want the flow to start when an item is created in the Employee Leave Requests list.

Let’s see how to create it:

1. Create an automated cloud flow. Give the flow name and select the trigger When an item is created. Also, provide the Site Address and List Name.

Attachments In Power Automate Approvals

2. I will take the Initialize variable action to store the attachments. To do this, provide the below Parameters as it is:

  • Name: varAttchments
  • Type: Select Array from the drop-down

Here, I changed the action name Initialize variable to Initialize variable | var Attachments.

Flow Approval Attachments in Power Automate

3. Next, add the ‘Get attachments‘ action and provide the below parameters:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Name: Choose a particular list.
  • Id: Select Id from dynamic content under When an item is created.
Approval Attachments in Power Automate

4. After that, take the Get attachment content action to retrieve the details from the attachment. Then, Provide the below parameters:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Name: Choose a particular list.
  • Id: Select Id from dynamic content under When an item is created.
  • File Identifier: Take Id from the dynamic content of Get attachments.

You can see that a For each loop will be added automatically, taking Body outputs from Get attachments.

Send approval request with attachment from SharePoint Power Automate

5. Then, add Append to array variable action inside the loop, and set the below details:

  • Name: Select the name from the drop-down.
  • Value: Insert the below given code.
{
  "name": "@{item()?['DisplayName']}",
  "content": {
    "$content-type": "@{body('Get_attachment_content')?['$content-type']}",
    "$content": "@{body('Get_attachment_content')?['$content']}"
  }
}
Send an Approval Request with an Attachment using Power Automate

6. Next, add the “Start and wait for an approval” action specifying to start of a manager approval process. This action has below fields:

  • Approval type: Select an approval type as “Approve/Reject – First to respond” from the drop-down.
  • Title: Enter the title field value from the Dynamic content.
  • Assigned to: Assign the email of the person who will approve/reject the request; in my case manager, I give the manager an email from dynamic content.
  • Details: Enter the details about the requested from the Dynamic content.

Then, click Show all to display the advanced parameters.

  • Attachments: Add attachments variable from dynamic content.
File attachments in Power Platform approvals

7. Now, we will add the Condition action to check whether the leave request is approved or Rejected.

In this Condition action, select the Outcome (from Start and wait for an approval action) value equal to Approve.

Add multiple attachments to an approval email with Power Automate

8. Next, add the Send an email (V2) action under True condition.

  • To: Take Employee Email from dynamic content.
  • Subject: Provide a subject line for a mail.
  • Body: Enter a detailed description of the mail along with taking dynamic content.
Power Automate approvals with SharePoint attachments

9. Under the False condition, take the Send an email(v2) condition and set the parameters as To, Subject, and Body as shown in the screenshot below:

How to Add Form Attachment in Power Automate Approval

Once the Flow is ready, we will move forward to run the Flow.

Run the Flow to Send an Email With an Attachment From the SharePoint List

Now, it’s time to save the flow. Click on Test -> Select Manually. Add an item to the SharePoint list with an attachment at this step.

How To Add Power Automate Approval Attachments

When the flow runs, it will send the manager an approval request with an attachment, as shown in the screenshot below.

How to Send Power Automate Approval Request with Attachment

This way, you can send approval requests with attachments from the SharePoint list using Power Automate.

Action ‘Append_to_array_variable’ failed: Unable to process template language expressions in action Power Automate

After creating the above flow, I checked with various scenarios, and I found that the flow successfully ran when the attachment files like PDF, Excel, Word document, jpg, or PNG, but when I tried with a text file (.txt), it gives me an error like below:

Action 'Append_to_array_variable' failed: Unable to process template language expressions in action 'Append_to_array_variable' inputs at line '0' and column '0': 'The template language expression 'body('Get_attachment_content)?['$content-type']' cannot be evaluated because property '$content-type' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'
Action Append_to_array_variable failed Unable to process template language expressions in action Power Automate

[Solved] Action ‘Append_to_array_variable’ failed: Unable to process template language expressions in action Power Automate

To solve this error, follow the steps below:

Open the Append to array variable action inside the loop, and set the below details:

  • Name: Select the name from the drop-down.
  • Value: Insert the below given code.
{
  "Name": "@{items('For_each')?['DisplayName']}",
  "Content": "@{body('Get_attachment_content')}"
}
Power Automate Unable to process template language expressions in action

Then save the flow; now add the item to the sharepoint list with a text file attachment. Then, you can see the approver get the text file in Outlook.

[Solved] Action 'Append_to_array_variable' failed Unable to process template language expressions in action Power Automate

I trust this Power Automate tutorial gave you an idea of how to send a Power Automate approval request with an attachment. Also, I discussed how to solve the action ‘Append_to_array_variable’ failed: Unable to process template language expressions in Power Automate.

Also, you may like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…