cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
aadilganie
Level 8

Flow Deleting Original Item And Newly Created Items

Hi!

I am not sure if this may be a bug but I have picked up on something.

 

i have a flow that runs on a SharePoint list when an item is created. The flow loops through a multi-lookup field and creates a new record for each lookup item found and then deletes the original item that was created.

 

The bug I think I found is on the delete step, the original item does get deleted but it also seems to delete the newly created items as well, which have different ID's. I used the ID from the first step in the delete step

 

Screen Shot 2018-02-22 at 20.32.35.png

 

Or.. Maybe I am doing something wrong, please assist?

 

Thanks!!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Flow Deleting Original Item And Newly Created Items

Hi @aadilganie,

 

Could you please share a bit more about the Product dynamic content within your "Apply to each" action?

Further, could you please show a bit more about your SharePoint list?

 

I think this issue is related to the "Create item" action within your flow. The "Create item" action would also trigger the "When an item is created" trigger of your flow. In other words, when the "Create item" action works within your flow, a new item is created in your SharePoint list, then the "When an item is created" trigger would monitor that there is an item created in your SharePoint list, so your flow triggers again.

 

In order to avoid this issue within your flow, please take a try with the following workaround:

  • Add a "When an item is created" trigger, specify Site Address and List Name.
  • Add a "Apply to each" action, input parameter set to Product dynamic content of the trigger.
  • Within "Apply to each" action, add a "Create item" action.
  • Under "Apply to each" action, add a "Condition", click "Edit in advanced mode", type the following formula:
@not(empty(triggerBody()?['Product']))
  • Within "If/yes" branch of Condition, add a "Delete item" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger.

 

Image reference:2.JPG

Note: The Product column in my SharePoint list is a Lookup type column with multiple values.

 

The flow works successfully as below:3.JPG

 

4.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Flow Deleting Original Item And Newly Created Items

Hi @aadilganie,

 

Could you please share a bit more about the Product dynamic content within your "Apply to each" action?

Further, could you please show a bit more about your SharePoint list?

 

I think this issue is related to the "Create item" action within your flow. The "Create item" action would also trigger the "When an item is created" trigger of your flow. In other words, when the "Create item" action works within your flow, a new item is created in your SharePoint list, then the "When an item is created" trigger would monitor that there is an item created in your SharePoint list, so your flow triggers again.

 

In order to avoid this issue within your flow, please take a try with the following workaround:

  • Add a "When an item is created" trigger, specify Site Address and List Name.
  • Add a "Apply to each" action, input parameter set to Product dynamic content of the trigger.
  • Within "Apply to each" action, add a "Create item" action.
  • Under "Apply to each" action, add a "Condition", click "Edit in advanced mode", type the following formula:
@not(empty(triggerBody()?['Product']))
  • Within "If/yes" branch of Condition, add a "Delete item" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger.

 

Image reference:2.JPG

Note: The Product column in my SharePoint list is a Lookup type column with multiple values.

 

The flow works successfully as below:3.JPG

 

4.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

aadilganie
Level 8

Re: Flow Deleting Original Item And Newly Created Items

Thank you so much, that worked!

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,678)