Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Can't filter array as item () invokes Id/Value from parent "for each"

(0) ShareShare
ReportReport
Posted on by 20

Hi!

 

First, a bit of context... I have a couple of Lists, 1. with the list of TEST CASES and 2. with the list of BUGS. When I create a new bug (in list 2.) and link it to a test case, through a "Lookup" column (which allows multiple selection as one bug could be linked to several test cases), I have a flow that blocks (status in a choice column) every test case affected by that bug and registers in another "Lookup" column the bug Id (in list 1.) -> this works ok!!

 

Now, when a bug is "resolved" (status in a choice column in list 1.), I would like for all the test cases affected by that bug to be moved back to "backlog" (status in a choice column in list 2.) if there are no other bugs blocking that test case and remove the bug Id from the "Lookup" column. Problem is that I cannot filter the array (when item()?['Id'] is not the Id of the resolved Bug) where I store all the bugs that are blocking that test case (coming from a "Lookup" column which allows multiple selection), since the filter action is inside a couple of "for each" loops... it invokes the Id/Values from the loops above.

 

Attached images:

1. Flow

2. Filter array where item()?['Id] is transformed to Id of the parent for each (LinkToTestCase)

2.jpg3.jpg

 

MANY THANKS in advance!

  • Verified answer
    webere Profile Picture
    20 on at
    Re: Can't filter array as item () invokes Id/Value from parent "for each"

    Hi again,

     

    I've found a solution... and it's a bit of a shame, not to mention very frustrating provided I've invested a couple of weeks in getting this resolved.

     

    I'm 99% sure there is a bug in the "New designer"... I'm new to Power Automate and by default the tool displays in "New designer", so I build the flow there, but I switch it to the "Old designer" when I was posting this thread since most of the screenshots I've seen in this community are using the old version. I re-ran the flow in the "Old designer" and it worked.

     

    Now, to be clear on the potential bug... in the "New designer" when you use the item function in a Filter Array, Select, etc, inside a loop, it invokes the item from the parent loop and not the item itself (in the case of a Filter Array, the array you want to filter).

  • webere Profile Picture
    20 on at
    Re: Can't filter array as item () invokes Id/Value from parent "for each"

    Hi @wskinnermctc !!

     

    Thanks for your reply. Right, it’s hard to grasp without that much background.

     

    Indeed, I want to filter an array that contains a number of “Blocked by Ids” with another array, but I can’t seem to make it work. As I understand, the way the filter array function works is first selecting the array you want to filter, and then adding the condition/s for the filtering by “cross checking” a value/variable with the array (or it’s values) itself using the item () function. So, in this case, item ()? [‘Id’] should reference the “Blocked Ids” array but it reference the ‘Id’ of the parent loop.

     

    ….Don’t know if I’m making any sense. I’ve posted another thread with more details: https://powerusers.microsoft.com/t5/Building-Flows/Delete-value-of-multi-selection-column-stored-in-array-based-on/m-p/2563793

     

    MANY, MANY thanks again for your help!! 

  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on at
    Re: Can't filter array as item () invokes Id/Value from parent "for each"

    I'm not exactly following all of the Id's and comparison process. However, if you want to identify the id of an item that is in the parent Apply to each, then use the full name of the apply to each.

     

    So if you are in the "For each blocked by Id" and wanted to use an action that has the id of the item from "For each item modified" then you would need to put then name items('For_each_item_modified')?['Id']

     

    Is that what you are referring to? 

     

    Or is it that you have a lot of Id's in the array "Blocked Ids" and you want to reference each one but it is not in the format Id: 123?

    You would just use item()

     

    Are those some things you can use? Otherwise I'm not really clear what you want to compare. It seems like you have a lot of things in place or know how to use them such as variables. 

     

     

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