Use Flow to update SharePoint list Item creating duplicate items

Copper Contributor

I am trying to use Flow to meet a user's requirements to:

1.  copy new items with attachments in List 1 to with attachments in List 2

2.  Update changes made in List 1 to List 2 in the same site

 

Setup:

2 SharePoint list - List 1 and List 2 with same columns (text, choice, metadata).

 

I created a FLOW using 'When an item is created or modified'.  

 

Result: 

1. requirements met

2. when a user updates a column in List 1, a brand new item is created in List 2.  If a user updates the 3rd time, a 3rd duplicate item is created.

I have been trying to add 'Condition' to part of the Flow but it did not work. I noticed that 'Condition' does not have 'Edit in advanced mode' but with 'Add' only.  I wonder if this has to do with the version of SharePoint online.  I cannot make requirement to work.

 

I searched a number of forums but I have yet been able to meet 2. 

 

Thank you for any help.

 

Condition_AddOnly.PNGCondition_AdvancedMode.PNG

10 Replies

Need to run them as separate flows. One to Create it in the first place and one to modify the meta data if it changes.

 

Just created the below and it seems to work. Note: the workflows only run every 3-5mins so you won't see a change until it triggers. Hope this helps :)

 

Use one list to modify another.JPG

Hi @spvan2019, what @Deleted has posted below is the solution for updating the other list item. The only thing I'd add, is you don't need to run them as two Flows. If you have a condition at the start which compares Created Date and Modified Date, you can branch your logic, and handle both scenarios in the same Flow.

Yes of course, thanks Matt for pointing that out ... I have normally separated them for clarity and ease of maintenance. But not a big deal to do what you suggest :)
Thank you both.
@Deleted
somehow, in my lists, it didn't work. I am working to see why it didn't work the same way like your. My lists do not use 'Title'. My site is still in SharePoint online 2013 I believe. I have not been able to make it work.

If the filter is not title, then you need to make sure the filter is referring to the ID rather than that associated text. 

 

This has caught me out a few times, especially for a lookup field. If using a lookup field, then use the ID field instead of the field name. 

 

You can check this but running the workflow and seeing what was returned, with Get list

Hi there,

Is there any way to avoid having duplicates. So every time an item is updated it creates a new item in the second list.

I am looking for something that stops that from happening.

Item creation in List 1 will lead to an item creation in List 2.
Item update in List 1 will lead to item being updated in List 2.

Right now the updating part doesn't happen. Updating item in List 1 leads to creating a new item in List 2.

Strange, if your filter is right then it should work fine. Because you should be using "update Item" and for me that does exactly what it says ... updates the item. It would only not do that if it could not find the item when you filtered it. What are you filtering on?

Filter is set to Title eq '@{triggerBody()['Title']}' 

I just tested again not all items are re-created in List 2 and some items are duplicated.

Attached screenshots of the Flow setup.Capture2.PNGCapture.PNG

Thanks!

Have you tried to add unique constraint to the SharePoint list column. That would prevent the creation of duplicates? (Tick enforce unique values, works for a subset of column types)

Hi @lvk5700 

 

I have created a couple of videos on this subject now:

FlowBites: Does it Exist (Part 1) - Filter Arrays: https://youtu.be/YLqMiDubA7s

FlowBites: Does It Exist? (Part 2) - Filter Query & Expression: https://youtu.be/x6QcntAs2_0

 

See if these help :)