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 / Flow error dealing wit...
Power Automate
Answered

Flow error dealing with array's and String variables

(2) ShareShare
ReportReport
Posted on by 147
I'm working on a flow where i want to extract the location text of an email subject line and compare them against a Array of locations and email addresses.  If the location matches it sends an email to the address in the array.  I believe my problem is comparing a string against a array and getting the following error.  

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Compose_array')' is of type 'String'. The result must be a valid array.
 
Here is the flow
 
flow-arrayerror.png
Categories:
I have the same question (0)
  • Suggested answer
    Power Platform 1919 Profile Picture
    2,217 Super User 2026 Season 1 on at
    Hi @,
    you can refer to this document for your use case : https://www.enjoysharepoint.com/check-if-an-array-contains-value-using-power-automate/

    Please give the mentioned solution a try and let me know whether it works for you.
    If it solves your issue, feel free to mark this thread as answered.
    Please make sure to like the response!
    Thanks!
    - Hemanth Sai

  • Verified answer
    Tomac Profile Picture
    4,105 Moderator on at
    In your Compose Array action, make sure you're not using a stray comma after your last curly bracket } and you close the overall bracket at the end with a ]
     
    These will cause the Compose action to set the output to a String instead of an Array.
     
    For more help than that, we will need to see the full output of the Compose Array action in a completed run.
  • Suggested answer
    stampcoin Profile Picture
    5,158 Super User 2026 Season 1 on at
    Your information is not enough.
    In the array, it only has Name and Email.
    So, in the loop, the condition (I guess), should be 
     
    equals(items('Apply_to_each')?['Name'], variables('varBUName'))
     
     
    or  just use item()
    equals(item()?['Name'], variables('varBUName'))
     
     
  • eenochs Profile Picture
    147 on at
     
    Thank you that worked, i was able to match them up.  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard