web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trouble getting attach...
Power Automate
Unanswered

Trouble getting attachment from multiple questions

(0) ShareShare
ReportReport
Posted on by
Hey all,
 
I'm having a bit of trouble I'm hoping I can get help with.  I designed a form that has multiple questions that require a file upload, but the form is split into different sections depending on the response so there will only ever be 1 attachment at the end of the form, which will be added to an email.  The form is split with a Switch control based on if its a billing or policy submission.
 
I created an array of the questions and their responses with an identifier of "Error" for question Type [ErrorQuestions].  I then filtered that array to only return an output for a question that has a response that is not empty [errorAnswer].
'
 
The result is this string (link is modified):
[{"name":"test_image.png","link":"PLACEHOLDER LINK","id":"01JGAH2FHXN25QPIYUBFEZQOJSAPDV7YPI","type":null,"size":9919,"referenceId":"01JGAH2FGTHNAIDTYW65BKDEJPK2EJYQ3L","driveId":"b!eYctZotxzUqc0IdvkhG8NJpC5q8pw2tGkIoxi8TUn9B42aNG2ACkRJ0t_3XDmfJl","status":1,"uploadSessionUrl":null}]
 
"If File Exists" checks ErrorQuestions is not blank.  If true, then it will move down a path to collect the content data and add an attachment to the email.  If False, the email is sent with questions that have no attachment.
 
The problem I'm having is getting the Compose action ErrorVal to parse errorAnswer's output to get the id or the name.  I've tried so many different ways, but I always encounter an error where either the output is empty or there is some syntax error where there's an invalid parameter or an unexpected value given.  It's like that output is not recognized as an array where I can use a command like outputs('ErrorAnswer')?[id] or some variation of that to go to the property position.
 
When I tried using a Parse JSON on ErrorQuestions, I always get a validation error when running the workflow.  This is the schema I used:
 
{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type":
                    "string"
            },
            "link": {
                "type"
                    "string"
            },
            "id": {
                "type":
                    "string"
            },
            "type": {},
            "size": {
                "type":
                    "integer"
            },
            "referenceId": {
                "type"
                    "string"
            },
            "driveId": {
                "type"
                    "string"
            },
            "status": {
                "type"
                    "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceid",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}
 
 
Is there some operation that will work to properly parse the output to get the name or ID, or a suggested better workflow?  Thanks for any help you can provide!
 
P.S.  I've tried using some "apply to each" loops to go through this and they somewhat worked, but it would then send emails for each iteration and not just the one that contained the attachment.  couldn't figure out the conditions to limit that... but the attachments still didn't get picked up.
 
 


 
 
Categories:
I have the same question (0)
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
    Hi,
     
    I didn't quite understand the question.
     
    But the following post may give you some ideas on how to fix the flow:
     
    As you are sending an email, the Append to array variable action will use ContentBytes for the property:
     
    The format of the attachments array for Outlook Emails, OneDrive and SharePoint.
     
     
    Ellis Karim
    Ellis Karim
    Blog | LinkedIn | Bluesky
    If this solved your issue, please mark it as ✅ Accepted Answer. If it helped, feel free to give it a 🩷 Like!
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard