Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Sending multiple optional files to Automate

(2) ShareShare
ReportReport
Posted on by 7
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
 
2= 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 :-) 
 
 
  • Pstork1 Profile Picture
    Pstork1 64,909 on at
    Sending multiple optional files to Automate
    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
     
     
  • Suggested answer
    JC-07101246-0 Profile Picture
    JC-07101246-0 7 on at
    Sending multiple optional files to Automate
    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

     
  • JC-07101246-0 Profile Picture
    JC-07101246-0 7 on at
    Sending multiple optional files to Automate
    @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
    Pstork1 Profile Picture
    Pstork1 64,909 on at
    Sending multiple optional files to Automate
    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
     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard