Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Flow Conditions and variables

(0) ShareShare
ReportReport
Posted on by 23
Hopping someone can share possibilities to help solve this:
I am wanting to add to my existing flow script that will delete an item in list2 based on criteria in list1.
 
The Story:
When an item is created in list1 an item is created in list2 with ID from list1. I want to go a step further and delete the item in list2 based on field data in list1
 
The Error message reads: The execution of template action 'Apply_to_each_3' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body/Audit_x0020_Status/Value']' is of type 'String'. The result must be a valid array.
  • Suggested answer
    DAP113 Profile Picture
    23 on at
    Flow Conditions and variables
    Yeahhh - this flow is now working. Why: There was another version of this flow that I hadn't turned off and I needed add a variable for condition2 to act on
    @David MA - thank you for your collaboration "If you want to delete the item you created in list 2, adjust the logic in your flow to not create the item in the first place when it meets the conditions you describe."
  • Verified answer
    David_MA Profile Picture
    11,549 Super User 2025 Season 1 on at
    Flow Conditions and variables
    Do you want to delete something from list 1 or 2? I still am not following the logic you have written so I think you'll need to wait to see if someone else understands your requirements. If you want to delete the item you created in list 2, adjust the logic in your flow to not create the item in the first place when it meets the conditions you describe.

    With that said, the new screen shot you posted does not show any errors in any of the actions. You said it does not work. What is not working if there are no errors in your flow? And with the new screen shot, you still do not show what you are doing in the two apply to each actions, which would be helpful to know what you are attempting.
  • Suggested answer
    DAP113 Profile Picture
    23 on at
    Flow Conditions and variables
    @David MA
    The business case is "When an item is created in list1; I want to create a new item in list2 with the same ID as list1....; If list1 field data contains "x" then do not create a new item in list2
     
    My approach is: 
    After list2 item is created to delete it if list1 ID and field data meet certain conditions, delete the list2 item
    The flow seems to work then 2-3 minutes later creates list2 item:
    :-( This is not working

  • David_MA Profile Picture
    11,549 Super User 2025 Season 1 on at
    Flow Conditions and variables
    I must be missing something obvious, but why are you creating an item only to delete it? That makes no sense. It would also help if you expanded the image of your flow to show the actions in the apply to each where the error occurred, so we know what you are doing there.
     
    You also mention that when you create the item in list 2 from the item in list 1, you store the ID of the item from list 1 in the item you create in list 2. You would use a Get items action and use a filter query to filter the field in list 2 where you store the ID from list 1 is equal to the id of the item in list 1. In other words: List1ID (from list 2) eq ID (from list 1).  I am guessing this is what you have in the apply to each 3, but since you don't show it, I have no idea.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May 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 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492