Tuesday, April 23, 2019

Gotcha in Microsoft Flow when handling SharePoint list item attachments

I’ve written a couple of these, where I in PowerApps allow the user to upload attachments to a list item. This feature can typically be used to upload documents or photos from the end user.

While list attachments work fine they are often easier managed in a separate document library, or perhaps you want to perform some other action on them. And this is where Flow comes into the picture. When the item is saved in SharePoint associate a Flow which triggers on new items in the list.

What is important to note is that when list items with attachments are created, the item is first created, and then each attachment will be a subsequent operation. When this action is performed using a phone or tablet the attachment upload might take some time, and Flow might very well trigger before all the attachments are done uploading - the effect being that Flow will miss some of the attachments, and your business process can miss some important data.

Here’s a sample Flow illustrating the logic: Flow triggers on new items, fetches the attachments, and process them.

A simple solution is to add a delay between the trigger and the action to retrieve the attachments. I’ve found 1 minute seems to cover the scenarios I have encountered so far, but the poorer the internet line, the more delay you might want to add.

Happy Flowing!