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 Automate / How to deal with an em...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on by 559

 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
 
Categories:
  • Verified answer
    v-chenzhi Profile Picture
    Microsoft Employee on at

    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

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 Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 425

#2
11manish Profile Picture

11manish 323 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard