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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sending multiple optio...
Power Apps
Suggested Answer

Sending multiple optional files to Automate

(2) ShareShare
ReportReport
Posted on by 13
Hello friends. 
 
I have this situation, I need to edit a row on my Sharepoint List and send the data to Power Automate. 
I also have a Document Library where I save all the files related to that edited row. 
 
So the thing is: I don't need to upload again all the files everytime I need to edit the row. 

These are the cases: 
 
File 1 File 2 File 3
Empty Empty Empty
Not empty Empty Empty
Empty Not empty Empty
Empty Empty Not empty
... ... ...
Not empty Not empty Not empty
 
23 = 8 cases. 

The thing is, I can't seem to find a way to get the right code. 

I tried this code, but it doesn't work.
 
    aprobacionEditarExternos080125.Run(
        {
            text: JSON(varObjeto);
            file: If(
                !IsBlank(attachCV_1.Attachments);
                {
                    name: Last(attachCV_1.Attachments).Name;
                    contentBytes: Last(attachCV_1.Attachments).Value
                };
                Blank()
            );
            file_1: If(
                !IsBlank(attachCertificado_1.Attachments);
                {
                    name: Last(attachCertificado_1.Attachments).Name;
                    contentBytes: Last(attachCertificado_1.Attachments).Value
                };
                Blank()
            );
            file_2: If(
                !IsBlank(attachTercer_1.Attachments);
                {
                    name: Last(attachTercer_1.Attachments).Name;
                    contentBytes: Last(attachTercer_1.Attachments).Value
                };
                Blank()
            )
        }
    )


It sends "Blank" and I need it to send nothing! 

I don't want to write 8 "If" codes... 

Do you guys know how to send multiple optional files? 

varJson and the 3 files parameters are optional on Power Automate. 

Please help! 

Thank you :-) 
 
 
Categories:
  • Suggested answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    For the attachments that don't exist you need to send a record with a value of null.  Try something like this
     
    file: If(
                    !IsBlank(attachCV_1.Attachments);
                    {
                        name: Last(attachCV_1.Attachments).Name;
                        contentBytes: Last(attachCV_1.Attachments).Value
                    };
                    null
                );
     

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • JC-07101246-0 Profile Picture
    13 on at
    @Pstork1 thank you for your answer. 
     


    Null is not an option for me. It is not recogniced 
     
     
                file: If(
                    !IsBlank(attachCV_1.Attachments);
                    {
                        name: Last(attachCV_1.Attachments).Name;
                        contentBytes: Last(attachCV_1.Attachments).Value
                    };
                    null
                );
     
     
    I tried these codes too... It didn't work either. 
     
    Using ""  :
     
                file: If(
                    !IsBlank(attachCV_1.Attachments);
                    {
                        name: Last(attachCV_1.Attachments).Name;
                        contentBytes: Last(attachCV_1.Attachments).Value
                    };
                    {
                        name: "";
                        contentBytes: ""
                    }
                )
     
     
     
    Using Blank()
                file: If(
                    !IsBlank(attachCV_1.Attachments);
                    {
                        name: Last(attachCV_1.Attachments).Name;
                        contentBytes: Last(attachCV_1.Attachments).Value
                    };
                    {
                        name: Blank();
                        contentBytes: Blank()
                    }
                )
     
     
    Each field is defined as optional. 

    So I don't know what's wrong :-( 
     
  • Suggested answer
    JC-07101246-0 Profile Picture
    13 on at
    I ended writing the 8 cases inside an If function... 
     
    I don't know what I'll do if I have to change 4 or more files... 

    24= 16
    25= 32
    26= 64

     
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    You can't just use Null.  It has to be used as a value in a record. So it should be something like.
    file: If(
                    !IsBlank(attachCV_1.Attachments);
                    {
                        name: Last(attachCV_1.Attachments).Name;
                        contentBytes: Last(attachCV_1.Attachments).Value
                    };
                    {name: null; contentBytes: null};
                );

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard