cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

image.png

This is what I see in the peek code for the side of my if statement which is where an excel file would end up.

View solution in original post

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

Hi all,

 

So I found the issue.  It was in the content expression.  I found the fix in another blog entry that I cannot locate again currently, if I do I'll post a link to it.  Basically the issue is as seen below:

 

Original expression I tried as noted in this thread:   body('Get_attachment_content')['$content']

Updated working expression:  body('Get_attachment_content')?['$content']

 

For me it appears the missing ? corrected the issue.  I can now attach Excel files to an approval flow using the updated expression.

 

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

@yashag2255 

 

 

 

 
Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

Hi

Can show full step to create the flow as I am trying to setup approval too

Do I first create from blank, select
PowerApps then
Create when item is created in SharePoint
??
I not sure how to setup. Can you please share the steps tks
Highlighted
Regular Visitor

Re: Power Automate approval with Attachments

This YouTube video (https://youtu.be/i01vMGr-qdA) explains the steps from A to Z pretty well.

Please note the video describes appending attachments via 'normal' Send an Email option so it uses "ContentBytes" key there.  While "ContentBytes" somehow doesn't work for Approvals email so you need to replace it with "Content" as @yashag2255 and @bschult2 mentioned in their previous threads.

If you get it right, it should look something like this via Peek Code view:

 

{ 

    "inputs": { 

        "name""arrAttachments", 

        "value": { 

            "Name""@items('Apply_to_each')?['DisplayName']", 

            "Content""@body('Get_attachment_content')?['$content']" 

        } 

    } 

}

 

It works for me. Hope it works for you.

Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

Hi Philip

 

Thank you for your reply.

 

Firstly, I did flow the video and create the flow as accordingly.  The attachment did not upload into the email and also no attachment in the SharePoint List, the flow is successful run. 

So I don't know what happened.  is it the variable name?  MS Form is name as Supporting Documents for attachment, does it affect the flow?

 

Flow works,but no attachment in list and email.Flow works,but no attachment in list and email.

 

 

or can I use Parallel Branch ??

 

Parallel.JPG

😥

or will this work??

JSON and Flow.png

 

 

am at a lost.. how to make the attachment (pdf) send with the approval email and update into the list.. what did I do wrong :(... Thanks.

 

This is driving me crazy..and I need to use it asap..  I had tried for months on it.. if someone has success with such flow, please help. 😞

 

Why so hard to get it up .. help..

 

Thank you

 

Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hi @bbsin 

 

You can check the below post on how to add attachments to approvals: https://www.bythedevs.com/post/how-to-add-multiple-attachments-on-approval-actions-in-power-automate 

 

And then in the attachments get the attachments from the form as shown in the previous responses. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

Hi yashag3355

 

does it mean that I change the megabyte content to content?

 

Sorry I am a developer so I don't really understand.  Tks

Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hi @bbsin 

 

Correct. Replace ContentBytes with content for the approvals. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

Hi yashag2255

 

I don't know why I change and the flow is working successful but still no attachment in list and email 😭

Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

Hi

Can I ask u since I can submit the attachment and information from MS FOR. OR powerapps (which also facing problem to send as Approval Flow) inti the List.
Is it because of office 365 that we are not ready that I cannot atach the file?

Can I create a approval flow just sending the respective link in SharePoint in the Start approval email so that the person can click the link to see the attahment?

TKS
Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

It generates only mail with attachment & for every attachment it generates separate mail.

No approval asked.

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

There are two different variables in the Attachment array, one for emails and a second for Approvals.

 

for email

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

 

For Approval actions

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

 

Attachments in Flow.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

used in Email

Attachments in email.PNG

 

Used in Approval

 

Attachments in Approval.PNG

 

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

@bbsin were you able to get the Power app Approval workflow to work correctly with attachments? look at my post with the screen shots. It took me three days to find that there are two different variables inside the Attachment array.

 

 

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

I had this but its not working, not collecting attachments.

Same JSON tried for email, getting no of emails equal to no of attachments.

 

But for sure for approval flow this is not working.

Highlighted
Helper V
Helper V

Re: Power Automate approval with Attachments

hI Jonathan

 

PowerApps to SP, really hard.. I cannot solve it..

 

As I need it urgently, I look into other sources , in the end I use MS Form to SP,  it's working.  

 

As for PowerApp..I might look into it look for now, I cannot solve.  Maybe later will revisit it.    Appreciated your great help.

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

Quick summary:  Thanks to @v-bacao-msft and @jonathanogden for the code snippets.  Ultimately, this was the only solution I found; to copy/paste in that code for Approvals in the Append to Array step.  Up to this point I have been able to simply construct the json using the GUI to insert DisplayName and AttachmentContent.  That doesn't seem to be working now as described below.

 

Details:

By inspecting the run history, and downloading the json attachment array, I confirmed the json was exact from a working flow to one I'm creating that isn't working.  After many hours of trial and error I can confirm at the time of this post, you must copy/paste the code for Approvals; using the GUI doesn't work like is has for the dozen or so approvals I've done up until now:

 

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

 

Otherwise you get an error:  The request failed. Error code: 'InvalidRequestContent'. Error Message: 'The request content was invalid and could not be deserialized: 'Unexpected character encountered while parsing value: {. Path 'attachments[0].content', line 1, position 605.'.'.

 

If you peek at the code, it appears there is a bug or something:

 

Bad code, using the GUI: 

{
    "inputs": {
        "name""varAttachArrayContent",
        "value": {
            "name""@items('Apply_to_each')?['DisplayName']",
            "content""@body('Get_attachment_content')"
        }
    }
}
 
Good code, copy/paste method:
{
    "inputs": {
        "name""varAttachArrayContent",
        "value": {
            "name""@items('Apply_to_each')?['DisplayName']",
            "content""@body('Get_attachment_content')['$content']"
        }
    }
}

 

As you can see, highlighted in red, ['$content'] is missing from the GUI method.

 

It is very frustrating when something that was working so well suddenly stops working! 

 

 

Highlighted
Regular Visitor

Re: Power Automate approval with Attachments

Hi, @bschult2 

Thank you so much.

 

Did I use "Get content file from path" from Sharepoint and append my array using body ('Get content file from path')? ['$ Content'].

 

*** Attention: My settings are set for the Portuguese language (BR)

 

1 - Get Content File from link:

Content_From_Link.png

 

2 - Append

Content_Files.png

 

 

 

 

 

 

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (5,041)