I need some help with a Power Automate flow that attaches files to from survey responses to an email. I followed this guide:
And have come up with this flow:
However, when saving I get this error:
If I remove either of the attachments (so there is just one, either just "Photo" or just "File"), it saves and the flow operates properly.
For example:
or
How can I do both attachments?
Thanks for any help!
I assume your attachments can be files and photos? It seems like the flow just treats them all as attachments so you should only need one variable? Otherwise you could merge the two arrays into one, but as I mentioned, but seems like you would just be recombining them.
@TL2 wrote:I assume your attachments can be files and photos?
That is correct, they can be files or photos.
@TL2 wrote:It seems like the flow just treats them all as attachments so you should only need one variable?
Is there another/better way to set this up, or a way to not treat them as attachments? As I said, I just followed the guide. My understanding is that two variables would be required, one for photos and one for files. If I could have just one variable and store all the files/photos though, that would be great! That would solve the issue I'm having currently I think.
@TL2 wrote:Otherwise you could merge the two arrays into one, but as I mentioned, but seems like you would just be recombining them.
I tried merging them at one point, but I was unable to get it to work. I would like to learn how to do this though!
My point is it appends attachments to the email. I don't think the variable cares what the attachment extension is (pdf, jpg, doc).
For my flow if the operators attached a pdf and took a photo, I would assume they would both be attached in the email.
@TL2 wrote:My point is it appends attachments to the email.
Please forgive my ignorance, I'm just learning how to use Survey123. What other options are there aside from appending the attachments to the email? Am I not using a suitable method?
@TL2 wrote:I don't think the variable cares what the attachment extension is (pdf, jpg, doc).
Meaning that I could use just one variable?
Thank you for the help by the way!
Yea, not could, should. One array variable.
@TL2 wrote:Yea, not could, should. One array variable.
So I did try this at one point, but the JSON was the issue I couldn't figure out. I currently have this:
{
"ContentBytes": @{body('HTTP')['$content']},
"Name": @{items('Apply_to_each')?['name']}
}
How do I add my second variable to this?
That looks correct. The array variable will gather as many attachments are included in the survey and append them.
Also add a condition to check if attachments exist (here I am calling them photos). If there are no attachments the flow will fail without an condition to send an email without attachments.