This post is decidedly more product-specific, but hopefully it will help someone out there facing the same issue that is looking for an easy fix.
The Problem:
The Flow is simple enough, it takes a submitted Cognito Form, does a handful of things, and ultimately populates a SharePoint List with the form information and attaches the form attachments to the list entry. This works exactly as expected for most forms submitted - assuming the files don't exceed a certain combination of size and quantity (which I didn't have time to nail down specifically during troubleshooting).Under most circumstances, the following Flow action would work just fine:
However, when the planets align just so, you get this instead:
The Solution:
What the error is basically telling us is the Content attribute of the Cognito Forms attachment is empty.We can verify this by checking the output of the Flow Trigger ('Cognito Forms: When a new entry is updated') to see what a working example looks like versus a failed run.
Here's what we get:
Working | Not Working |
Thankfully, the Cognito Forms trigger does provide us with an attribute called 'File'. This is a direct link to the attachment (that expires after a certain length of time) which we can use to retrieve the file content ourselves! How do we do that?
With an HTTP GET action!
Simply place an 'HTTP' action before the 'Add Attachments' action like so:
The Output ('Body') of this action will be the attachment - which is returned as an Object (which, after a lot of banging my head on the desk trying to convert this to something else, is actually exactly what we want!).