Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to deal with an empty XML File in Power Automate?

(0) ShareShare
ReportReport
Posted on by 555

 I have an XML File generated by a PowerBI report and sent to us as an email attachment.

I have a FLOW1 that takes the Email attachment and places in a SP Library.

My Flow2 takes the File Content from SP Library and creates records in the SP List.

The FLOW2 works fine as long as there are records in the XML File.

However, we got an XML file with no records. My FLOW failed at Parse JASON step.

How do I circumvent this issue as every now and then there may be a file with no records - Just a header?!

 

I tried condition step with 

length(outputs('Get_file_content')?['body/value'])  greater than 0
and
it gave me the following error:
"InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '39899': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#length for usage details.'."
 
Please help.
Thanks,
SueA
 
  • Verified answer
    v-chenzhi Profile Picture
    on at
    Re: How to deal with an empty XML File in Power Automate?

    Hi @SueA ,

     

    When the xml file is empty, do you want to continue running the flow2 even if Parse JSON fails?

    I found an alternative method for your reference, please try the following workaround.

    vchenzhi_0-1637292768035.png

    Choose Configure run after, Select all these scope statuses you need.

    vchenzhi_1-1637292768038.png

    Here is the expression:

    result('Scope')[0]['status']

     

     

    Best Regards,

    Zhi Chen

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1