cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Unable to attach the correct attachment

1) Currently my flow is able to attach the file from onedrive (I attach a file to forms and it auto get uploaded to onedrive). But it is not attaching the correct file to match the correct form.

 

2) My start and wait for an approval took >5mins to process and send the request to me

 

1.PNG2.PNG

15 REPLIES 15
Highlighted
Resolver IV
Resolver IV

Re: Unable to attach the correct attachment

@HelloHello 

From what I can see in the flow you are looping through all the attachments in the folder. This may be picking up attachments from previous submissions of the form.

 

I found that when I submitted a form with files uploaded the question that had the attachments returned JSON.

 

I was then able to parse the JSON and use the array to loop through the attachments and get the file based on the ID and this seems to return the correct file.

Screen Shot 2019-12-11 at 8.03.54 pm.png

 

I have created a video on YouTube for handling attachments from forms which can be found here https://youtu.be/IDW3ikTHu9U

Also here is a link to the schema for parsing JSON from the question for forms

https://gist.github.com/ghunt03/44a41fe53c9a0bc6e16d9f2a6afd08e4

Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@Gareth1 

 

The video is unavailable for view

Highlighted
Community Support
Community Support

Re: Unable to attach the correct attachment

 

Hi @HelloHello ,

 

What do you mean "But it is not attaching the correct file to match the correct form."?

Please provide more details about it.

 

For your second question, this is a known issue. If you add an attachment to an Approval action, the Approval process will always be pending.

We have reported this issue and are currently working on it.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@v-bacao-msft 

 

1) Eg. I attached this file 3 to my form and it gets uploaded to Onedrive

1.PNG

But my attachment received in my approval request email is not the correct attachment

2.PNG

 

2) If I were to approve the request, it will never run through to update my sharepoint etc?

Highlighted
Community Support
Community Support

Re: Unable to attach the correct attachment

 

Hi @HelloHello ,

 

For the first question, you mean you added three files as attachments, but only one of them is displayed in the email? Or did you choose file 3 as an attachment, but it turned out that file 1 was sent as an attachment?

 

In the second case, look at the Flow run history and check if each run of the Append array variable action appends the expected file to the array.

 

For the second question, this is an already-issued issue. Although the request has been approved, the approval action is always running and the following actions cannot be performed. This issue is currently being resolved.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@v-bacao-msft 

 

1) I added one file (file 3) only but it is capturing file 1 which was added even earlier

 

Can I check what does this mean: In the second case, look at the Flow run history and check if each run of the Append array variable action appends the expected file to the array.

Highlighted
Community Support
Community Support

Re: Unable to attach the correct attachment

 

Hi @HelloHello ,

 

You can open Flow run history and see every run in Apply to each.

 

Check which file name is currently in the Append to array variable action and check if it is as expected.

 

 

I noticed that you don't seem to use the variable properly.

You should configure the approval action outside of Apply to each.

Using array variables is to add multiple files to an approval email, and your configuration seems to violate the original requirements.

If you want to add multiple attachments in one approval email, then you should use this configuration.

138.PNG

 

Best Regards,

 

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@v-bacao-msft 

 

It is now attaching all the files which is not what I need haha.

 

I need the file that is attached to form to be send in the approval request.

 

Eg File A attached -> Approval request attach File A

Eg File B attached -> Approval request attach File B

Highlighted
Community Support
Community Support

Re: Unable to attach the correct attachment

 

Hi @HelloHello ,

 

Ok, back to your previous configuration, if you don't want to add multiple attachments in one approval email, then you don't need to use variables.

You just need to configure the approval action like this.

139.PNG

And you can set Apply to each like this.

140.PNG

Hope this helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@Gareth1 

 

I tried your parse method and it is able to retrieve the correct attachment. But my parallel function for delay ends up not working.

 

1.PNG2.PNG

Highlighted
Resolver IV
Resolver IV

Re: Unable to attach the correct attachment

@HelloHello 

Are you using the Start and Wait for approval?

 

As v-bacao-msft

So it will continue to run for as long as the do until loop is allowed

 

While the issue is been fixed you may need to consider using a link to the file instead of using an attachment, which I think should work

Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@Gareth1 

 

If link, do I need to still parse JSON?

Highlighted
Resolver IV
Resolver IV

Re: Unable to attach the correct attachment

@HelloHello 

 

If you parse the JSON you can extract the link from the response, however this link will be to the file on OneDrive if that is where the file is saved. So you would need to share the folder with those who need access. Otherwise you would need to look at moving the file submitted through the form to a location they have access to, for example a Sharepoint Document Library

 

If you can share the folder it seems to work ok

Screen Shot 2019-12-12 at 8.07.36 pm.png

 

 

Highlighted
Helper IV
Helper IV

Re: Unable to attach the correct attachment

@Gareth1 

If I do not use the start and wait for an approval. I use create an approval and wait an approval separately, will it work with the attachment?

Highlighted
Resolver IV
Resolver IV

Re: Unable to attach the correct attachment

I just quickly tested it and had the same issue

I think the issue with approvals and attachments seems to be around the waiting

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (5,826)