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 / The execution of templ...
Power Automate
Unanswered

The execution of template action 'Apply_to_each_3' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array.

(0) ShareShare
ReportReport
Posted on by 21

Hi,

 

I am trying to filter files in an array I have (using "Filter Array") and then delete the files in the folder I am filtering that are older than 15 days.  The old files are the output of the "Filter Array" action.  I then use the "Delete files" action and keep getting this issue: 

 

The execution of template action 'Apply_to_each_3' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array.

 

When I am trying to delete the files, it creates Apply to each loops automatically and then runs this error.  Is there a way I can fix this?

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @revolutionenerg ,

     

    Please provide the screenshot of your flow.

     

    Best Regards,

    Wearsky

  • revolutionenerg Profile Picture
    21 on at

    Hi there,

     

    Here it is:

     

    Screenshot 2023-03-23 080432.png

     

    The subtract expression in the filter array is to figure out which files were created more than 15 days ago

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @revolutionenerg ,

     

    Please try this:

    vxiaochenmsft_0-1679622311410.png

    item()?['{Identifier}']
     
    Best Regards,
    Wearsky
  • revolutionenerg Profile Picture
    21 on at

    That worked, thank you!

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