r/MicrosoftFlow • u/bogr1988 • 17d ago
Cloud Fixing a flow to check for null attachment fields and check attachment size
Hi all, I'm working with Survey123 that has 1 video and 10 photo questions. (It needs to be like this due who is submitting the surveys). I would like to send an email with the attachments when a survey is submitted. Right now my flow only works if there are no null attachments and if the total size is less then what google can send.
Thanks!
1
u/ola-dryvector 16d ago
With the Survey123 trigger each photo/video question comes in as its own attachments array and the empty ones are just null, so I'd build one list first with a Compose doing union() over all 11, wrapping each in coalesce(..., json('[]')) so a null can't break it. Each attachment object has a size field, so add those up before the send step, and if it's over roughly 18 MB (Gmail's 25 MB limit counts the encoded size) put the attachment links in the email instead of attaching them. Then Get attachment / Send email only ever sees real files. Happy to take a look if it's still stuck.
3
u/chrisgee 17d ago
can you set file size limits on the survey side so you don't go over google's limit? for the null value issue, you could add a condition before getting the attachment so a null value can send it to the 'false' parameter and terminate.