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 / Flow Conditions and va...
Power Automate
Unanswered

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.
Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    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.
  • Suggested answer
    DAP113 Profile Picture
    23 on at
    @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

  • Verified answer
    David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    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
    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."

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard