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 / forEach condition "Con...
Power Automate
Unanswered

forEach condition "Contains" element Not Registering

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm having trouble with PAD recognizing the "contains" function within a forEach loop in two congruent scenarios.

 

#1:

Capture1.JPG

 

I've extracted the innerHTML strings within the column of a website table, and stored them within the variable "USB_Data_DescHTML".  I then want to perform two separate functions on each item of this variable depending on whether or not its innerHTML contains "<br winautomationvisibilitylandmark="true">".  When I run this action, PAD registers this condition as false even when I'm absolutely positive that the current item contains the aforementioned string.  

 

----

 

#2

Capture2.JPGThe same applies if I attempt to use a List.  This condition also returns a false value when I'm absolutely certain the condition is true.  

 

What am I missing here?

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Can you double check the text? Looks like there's some weird formatting going on:

    Henrik_M_0-1619949460370.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Henrik_M 

    Yes, the formatting was wrong in the first example.  However, everything checked out in the second and it still wasn't working.  Therefore, I played around with it some more and discovered that if the two variables are switched then it works. 

     

    So when using the operator "contains" on a List to satisfy an "if" conditional within a forEach loop in Power Automate Desktop, the List needs to be the first operand, and the "current item" of the data being looped needs to be the second operand.  Works like a charm now.

    Capture.JPG

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 247 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 164 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 138 Super User 2026 Season 2

Last 30 days Overall leaderboard