cancel
Showing results for 
Search instead for 
Did you mean: 

Adding an Attachment to an Approval Email In Flow

You should be able to attach a document to an approval email using flow. 

Status: Started

We are now working on the functionality to attach files to Approval requests.

Comments
Level: Powered On

@GFinlayRPS I'm having the exact same issue as you. It works for send email with options but not for approvals. 

Level: Powered On

Hmm @GFinlayRPS  - the "content" appears differently in your screenshot to what I see.  Here are some screenshots of my Flow in edit mode, a successful run and the attachments on the approval email - hope these help you get it working too:

1. Edit mode

Flow Edit.png

2. Successful run review

Flow.png

3. Approval email with attachments

Approval.png

Power Automate Staff

As @viewfile mentioned the solution to appending an approval attachment object to an array variable is something similar to:

{
  "name": @{items('Apply_to_each')?['DisplayName']},
  "content": @{body('Get_attachment_content')}
}

This matches the schema for approval attachment input which is an object whose properties are:

  • Name - a string
  • Content - a base 64 encoded string (the file contents).

 

The schema from the provided pictures along with the error shows that you are passing in the content as the "ContentBytes" property and not as "Content". When dealing with an advanced feature such as expressions it's important to note that you are working directly with JSON properties which will not always match the display name shown on the inputs which are there to improve readability. The JSON properties for trigger/actions will vary.

 

 

 

 

 

Level: Powered On

Hi @viewfile @TCambs  appreciate the help, it's helped me understand the issue.  It seems to be the way that Get attachment content is outputting, as you can see from the images below it is outputting in the format
{

  "$content-type": ,
  "$content":
}

 

which is how the Append to array variable 2 is handling the Attachment Content, @viewfile would it be possible to see a screenshot of how your Get attachment content outputs?

 

Annotation 2019-12-10 092929.png

 

 

Annotation 2019-12-10 093832.png

 

I'd like to point out that like @Aiyaa  this still works with sending an email using an Office 365 Outlook365 Action.

 

Thanks

Level: Powered On
 

@TCambsI followed your instruction and it is still giving me the similar error. I assume it'll be fixed this Friday or next Monday like you mentioned...? Capture.PNG

Level: Powered On

@Aiyaa I have worked it out.  Instead of using the Attachment Content from Dynamic Content go to Expression and type in

 

body('Get_attachment_content')?['$content']
 
The image below shows you the way I was doing it first that wasn't working and the second Append to array variable which works using Expression.
See the following link for reference 
 
InkedAnnotation 2019-12-10 170950_LI.jpg
Level: Powered On

@GFinlayRPS  YOU ARE AMAZING. When tested, the emails did go out with multiple attachments. Again, you are amazing and thank you very much! 

Level: Powered On

I managed to get the attachment working on approval email. However, when I take action (approve / reject) the workflow is stuck in running state. It doesn't progress to subsequent steps in the flow. I tested multiple scenarios and waited for approx. 20 hours and the flow was still running. I removed the attachments from the 'Start and wait for an approval' step, then re-submitted the flow. It worked immediately and was successful.

 

Am I missing something or is this a bug?

Level: Powered On

@Mohammed_1 same thing seems to be happening to me, conduced my final test yesterday after I posted this and solution and came back into work this morning and the flow had been running for 16 hours.  I tried a fresh one this morning and it seems to be hanging on the approval action like you said.  All that my flow does after the approval action is update a value in a SharePoint list.  @TCambs is this something that you can replicate?

Annotation 2019-12-11 092142.png

 

Annotation 2019-12-11 092201.png

Level: Powered On

@GFinlayRPS well, I've got an update here. I submitted a new flow with attachments today. It was successfully completed after a delay of 1 hour