cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LazarPetkov
Frequent Visitor

File attachment from a form breaks when attached in approval

Hi Community,

I have been trying to attach a form submission file in an approval. For some reason it seems to work for the first approval in the chain and the file is accessible. In the second approval further down in the process the attachment is corrupted and has increased in size from 20 to 27 kb. Technically, it has the same name but has changed for some reason.

 

I have followed this approach in order to avoid the issue with the content bytes: https://powerusers.microsoft.com/t5/General-Power-Automate/Flow-attachment-Error/m-p/1348202#M81123

I have also created two variables - the first one for the emails and the second one for the approvals. 

 

LazarPetkov_0-1659365031343.png

The JSON is formatted as follows:

LazarPetkov_1-1659365228631.png

In addition, I also tried to format the content as 

"name":DisplayName,
"content": base64(body('Get_attachment_content'))

 

LazarPetkov_2-1659365493249.png

The approvals are configured as First to Approve and the file which causes the issue in the second approval is attached in both Approval steps as a dynamic variable. I just can`t figure out why it works only for the first attachment and not for the second one.

Best Regards,
Lazar

18 REPLIES 18
ekarim2020
Super User
Super User

Hi @LazarPetkov ,

 

I use the following format for the attachment arrays (with the attachment taken from a Forms submission):

Snag_1d6544c.png

 

Please provide a screen shot fo the flow for the Approval actions.

 

See also: How to send Microsoft Forms file uploads to an Approval workflow using Power Automate – Ellis Karim'...

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Ellis,

I am using an Apply to each action in order to extract all files in case of multiple attachments.

LazarPetkov_0-1659429328135.png

My approval action looks like that:

 

{
"name": @{items('Apply_to_each_RnRTemplate')?['name']},
"content": @{body('Get_file_content_using_path_2')}
}

Hi @LazarPetkov ,

 

Please confirm:

 

(1) The issue is that the attchment array works for approval 1. The same attachment array (attachment_approvals_2) does not work for approval 2?

 

(2) The file or files that are being attached to the approval workflow are coming from a Microsoft Forms submission? The screenshot shows you are getting files from SharePoint.

 

(3) Please show the approval actions for both actions and confirm that they are using the same array:

 

ekarim2020_0-1659429884679.png

 

Can you share the entire flow?

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

 

Hi Ellis,

 

(1) The issue is that the attachment array works for approval 1. The same attachment array (attachment_approvals_2) does not work for approval 2? - That is correct. Identical attachment array works in one approval action it does not in another.

 

(2) The file or files that are being attached to the approval workflow coming from a Microsoft Forms submission? The screenshot shows you are getting files from SharePoint. - That is also correct. In the parse JSON action, I have selected the output from the upload question in the form. Then I am extracting the files using the output from the JSON in the Apply to each action. This is a quite common approach.

LazarPetkov_1-1659431368705.png

LazarPetkov_8-1659432192200.png

 

LazarPetkov_7-1659432166613.png

(3) Please show the approval actions for both actions and confirm that they are using the same array:

 

Approval Step 1:

LazarPetkov_4-1659431708422.png

Approval Step 2:

LazarPetkov_5-1659431779035.png

Unfortunately, I will not be able to share the flow as there may be confidential company-owned information in it.

 

Best Regards,
Lazar

 

 



They look identical.

 

As a test, can you (1) remove the attachment array from approval action TRHA0vYzZs, (2) save the flow, (3) then add the attachment array to the flow again:

 

Snag_29ea882c.png

Is it an option for you to delete the action TRHA0vYzZs and thenre-create it?

 

Some times actions in flows do get corrupted and an easy solution is to delete the action and re-add it, or to save a new copy of the flow and test this new version.

 

 

Ellis

Hi Ellis,

I have already tried to remove and add the attachment variable again and that approach did not have any effect on the issue. 

Rebuilding the approval would require a lot of work since I am using some of the output attributes from it the next steps. E.g. Update a Row where I extract the Approval Date, Approver`s name, comments, etc.

 

LazarPetkov_0-1659441043187.png

LazarPetkov_1-1659441128957.png

The above snippets are from my outlook. The approvals that were generated. Note that the size is different and while the first file opens without a problem the second appears to be corrupted.

Best Regards,

Lazar

This is a demo flow I ran. The flow has two approval actions both approcl actions are using the same attachment array:

 

Snag_2a2fc9f8.png

 These are the approval emails:

Snag_2a3174ca.png

Snag_2a319e4b.png

 

Flow setup based on: How to send Microsoft Forms file uploads to an Approval workflow using Power Automate – Ellis Karim'...

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Ellis,

 

I spent too many hours trying to figure out what the issue is. The funny thing is that the method that I have used works in other flows that I have. It causes problems only with this approval. I will try your method of file extraction and see if this would fix the issue. Would you mind sharing the flow with me? 

 

Best Regards,
Lazar

Hi @LazarPetkov ,

 

The flow is the same as in this post but with an addition of a condition and second approval action:

How to send Microsoft Forms file uploads to an Approval workflow using Power Automate – Ellis Karim'...

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Ellis,

I will try it out and reply back later today. Cheers!\

 

Best Regards,
Lazar

LazarPetkov
Frequent Visitor

Hi Ellis,

I have used your approach and followed every single step in the article. Now my flow breaks at the first approval with the following message:

LazarPetkov_0-1659479268379.png

Best Regards,
Lazar

LazarPetkov
Frequent Visitor

Hi Ellias,

 

I have tried to convert the file content to base64(). This worked well for the first approval. I got where I started. The attachment seems to be working for the first approval but changes in size and appears corrupted in the second approval. The extraction method and everything else are as per your article.

 

LazarPetkov_3-1659481390092.png

 

I have tried with different files and I am getting the same exact result.

Best Regards,
Lazar

Please share the screenshot of the Append to Array action and the error message in the the Approval action, for example:

 

Snag_2c749b4d.png

Snag_2c74b770.png

I get the above error when I use contentBytes in the append to array action:

Snag_2c762587.png

 

The approval actions works if the append to array action has the following format:

Snag_2c7bb991.png


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

LazarPetkov
Frequent Visitor

Hi Ellis,

I am using "Content:" in the Append to Attachment action for the approvals.

LazarPetkov_0-1659484118271.png

These are the screenshots from the error:

 

LazarPetkov_1-1659484234107.png

LazarPetkov_2-1659484262617.png

Best Regards,
Lazar

Hi @LazarPetkov ,

 

I'll rebuild and test the flow in a different MS 365 tenant to see if I get any issues or if I am able to reproduce the same issues.

 

Work around: Can you use two different array variables: use one array varible for Approval 1 (content to base64()) and the other for Approval 2.

 

Ellis

 

LazarPetkov
Frequent Visitor

Hi Ellias,

 

Workaround: Can you use two different array variables: use one array variable for Approval 1 (content to base64()) and the other for Approval 2. - I have already tried this two days ago. Funny enough the same error occurs.

 

It looks like a bug but I am unable to identify what causes it.

Best Regards,
Lazar

LazarPetkov
Frequent Visitor

Hi Ellias,

 

Work around: Can you use two different array variables: use one array variable for Approval 1 (content to base64()) and the other for Approval 2. - I have already tried this two days ago. Funny enough the same error occurs.

 

It looks like a bug but I am unable to identify what causes it.

Best Regards,
Lazar

>>>>It looks like a bug but I am unable to identify what causes it.

Yes! ☹️This is not the expected behaviour for a straight forward operation and we havent yet found the cause .

 

You can report bugs here:

I Found A Bug - Power Platform Community (microsoft.com)

 

Or Admins can request support from Microsoft:

Get Help + Support - Power Platform | Microsoft Docs

 

Ellis

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (2,623)