cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Copy items between two SharePoint lists

Hi all.

 

I have a problem copying data between two SharePoint lists, and I cannot figure out what causes the problem. I have two SharePoint lists (SharePointBooks and SharePointBooksDestination). When a new item is created in SharePoint Books or modified, i Want the changes to be updated in the SharePointBooksDestination list.

 

I have read a ton of documentation for example this one from MS:

MS support article

And I have found this article on this great forum:

https://powerusers.microsoft.com/t5/Building-Flows/Copying-items-between-lists-using-filtering/m-p/2...

 

The last article gave me some good hints, and it works almost perfect. The challenge is that, no matter if I create or modify a item in the SharePointBooks list, it will always create a new item in the destination list. This should only happen whaen I create a new list item. I have some pictures of the flow:Flow01.PNG

I have a column in the destination list (MasterID) where I store the ID from the SharePointBook list, and I use these as a filter.Flow02.PNG

In the condition I have this expressionFlow03.PNG

And i the value I have this expression.

When I look at the flows that has been running, they all seems to create a new item, no matter what, and I can see from the flows that has been running, that the body is empty. Se below:Flow04.PNG

Does anyone knos how to fiks this? The flow works fine with no errors, but I only need to create new list items when the item is not in the destination list.

 

Greetings From Denmark

/Frank

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver III
Resolver III

Re: Copy items between two SharePoint lists

Hi @venseben,

Could you try usingthe expression

length(body('Get_items')?['value'])

is equal to 0 for your condition as below?

LengthCondition.png

 

This is essentially checking the length of the array returned by your filter query. If there are not items returned, the length should be 0.

Let me know if this helps, if it doesn't I'm sure we can figure something else out!

View solution in original post

4 REPLIES 4
Highlighted
Resolver III
Resolver III

Re: Copy items between two SharePoint lists

Hi @venseben,

Could you try usingthe expression

length(body('Get_items')?['value'])

is equal to 0 for your condition as below?

LengthCondition.png

 

This is essentially checking the length of the array returned by your filter query. If there are not items returned, the length should be 0.

Let me know if this helps, if it doesn't I'm sure we can figure something else out!

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Copy items between two SharePoint lists

Hi @jwhite and THX for quick reply. I have tried your solution, but it still keeps going on with creating a new item instead af updating the existing item 😞

 

I have changed the Filter Query to "Title eq 'Title' (from Dynamic content).

The output from the trigger:Flow05.PNG

 

The Filter Query from the Get Items actionFlow06.PNG

So I am a bit frustrated right now. The condition says, that if the expression length(body('Get_items')?['value']) is equal to 0 then create a new item, but it still creates new items when I make changes to existing items.

 

I have tried to change the value in the condition to true, but it does not change anything :(:(:(

 

/Frank

Highlighted
Helper IV
Helper IV

Re: Copy items between two SharePoint lists

UPDATE UPDATE UPDATE

Hi again @jwhite. I do not know what I did, but suddenly the flow seems to work as intended from your suggestion. I am SO happy. I have spent hours and hours to make it work.

 

Have an awesome day

 

/Frank

Highlighted
Helper IV
Helper IV

Re: Copy items between two SharePoint lists

Hi @jwhite and sorry for writing again, but I have another issue with this challenge that i can not figure out.

 

In the parent list I have a checkbox, and it shoud only be items were the value in the checkbox is equal to True that shoudl be copyed to the destination list. I have tried to make a AND/OR condition in Flow but it seems not to help. In need this:

 

Parent list
If an items is created or modified AND the checkbox is equal to True

  1. Chek if the items exists in the Destination list
  2. If not - create item
  3. If it exist - update item

Hope you understand my challenge here. Do you have any suggestion to a solution? I can not figure out why a simple condition will not work for me 😞

 

/Frank

 

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

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

Users online (3,432)