cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Using Flow to copy data between two lists

I'm hoping to get some guidance. I found this Flow Blog and it worked exactly as intended: Copying Using Filtering However, I need what is discussed toward the bottom around using unique ID's to prevent new items always being created. Here's the verbiage: 

 

Another limitation is if the field that you are using to keep items in sync between the two lists changes, a new item will be created in the destination list. For example, if you are using a person's Name to copy between the two lists, and their Name changes, the flow will think that it is a new item, not an update to an existing item. If you can guarantee that the Name will never change then you won't be impacted by this. However, if Name is a field that can change, you will need to add a new column to the destination list that stores the ID of the item in the first list. In this case, rather than using Name to find items, you can use ID instead (and the ID is guaranteed to always be unique).

 

I'm struggling to figure out how to make this work correctly and don't know enough about creating filter queries and condition syntax to resolve it on my own. Any help would be appreicated.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

@faustocapellanj

 

First off, I really appreciate all of your help. The solution you posted didn't work 100%. It did start spitting out values and I made some changes to the YES/NO paths. For whatever reason in both update item and create item, it wanted the dynamic content from the source (SMART Space) list. By selecting those and using the field from "When an item is created or modified" and NOT "Get Item" it worked. See below:

No.jpgYes.jpg.

 

Without your help I wouldn't have gotten this figured out. It works swimmingly and whenever an item is created or updated in the source list, it "flows" to the destination (Staging) list... for now. *crosses fingers*

View solution in original post

21 REPLIES 21
faustocapellanj
Memorable Member
Memorable Member

Hi @Anonymous,

 

Something similar to this came up in a recent post here in the forum. The idea is that one list (Daily List) has items created automatically on a daily basis by a specific flow, and several other lists (Custom Task Lists) will have a daily item created by a given user. Then the item from the Custom Task Lists will have a unique ID that will be used to compare the pertaining item in the Daily List and then update its status. Check out the link and let me know if this is something you would like to achieve.

SharePoint Item is Created -> Update Item

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

Not quite.

 

Here's a kicker for you. I followed those instructions to a "T" in that article, and now, for whatever reason it wants to make an array under the "yes" condition. So, right now I have a half-assed flow working.

 Works

 And the copy.. forces creation of an array that returns zero results.

Busted

 

Any thoughts?

Hi @Anonymous,

 

Can you please post your lists structure and screenshots of your flow steps so I can try to replicate on my end?

 

Thanks,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

Hi @faustocapellanj,

 

Sorry about that.

 

here are the photos that i intended to show in my prior post

 

The first one works, the second does not. the only other difference i see is the time to process

Untitled.jpgUntitled(2).jpg

Hi @Anonymous

 

I need to see the steps from when you edit the flow, not when the flow runs. This is so I can see how your flow steps are configured and I can easily replicate on my end. I should have been more specific on my previous post. My apologies.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

Absolutely. I'll make two posts. The first one being the "broken" flow, and the second being the one that works.

 

For reference, in list 1 (SMART), I have five columns to pull. List two is "Staging" and Flow 1.jpgFlow 2.jpgFlow 3.jpgFlow 4.jpgfield names are the same five columns.

Anonymous
Not applicable

@faustocapellanj

 

Here's the functional one. 

Flow 5.jpgFlow 6.jpgFlow 7.jpgFlow 8.jpg

 

I also thought this might be interesting as populated from the dynamic content menu.. it's slightly different than it was

Values.jpg

@Anonymous,

 

Is the value of the Title column uniqute to each item or is it used over in other items? I'm just trying to picture if the Title column can be used as unique ID when flow copies data between the lists. Another question: is the data copy a one-way process?

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

@faustocapellanj

 

Yes, each item is unique. I'm using the "What" column as the title (by rename). In this case, I would not have multiple of the same "What" values. Each "What" entered is unique. 

 

Yes, the data copy is one way to prevent endless loops.

Hi @Anonymous,

 

Looking at your flow steps, shouldn't you be queryin the Staging list to make sure the item you are creating in the SmartSpace list doesn't exist there? I see you are querying the SmartSpace list instead.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

@faustocapellanj

 

Thanks for your continued help. Maybe I have something backwards. The intention is that Smart Space is the origin so the flow should go from Smart Space into the Staging list.

 

What I want is that when a new item is added to Smart Space it gets pushed to Staging and if an item is updated in Smart Space it updates in Staging. I'd be happy to get newly created items only. Updates are like extra credit.

@Anonymous

 

Change the Get items to the Staging list and not the SmartSpace one. Then the condition will return false if the newly created item in SmartSpace does not exist in the Staging list. From there, create the item in the Staging list under the Yes condition.

 

Please try it and let me know.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

@faustocapellanj

 

no such luck. when the flow runs and returns either a true or false condition, the yes/no branch displays "the array input was empty". (i tested both ways to validate)

Anonymous
Not applicable

@faustocapellanj, it also may be worth noting the expression returns value as true for both 0 and 1 values so perhaps the condition is written incorrectly? i think i see where you're trying to go..

@Anonymous

 

The expression in the condition is fine. What do you get in the Get items step after the flow runs? I just ask because for the array to be empty, it means you're not getting anything in the Get items step.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

@faustocapellanj

 

here is what it has in the "get items"

Test 2.jpg

 

the condition also returned as "true"

@Anonymous

 

This might be a long post so I will split it in 3 posts:

  1. All Flow steps
  2. Results when item is created in SmartSpace list
  3. Results when item is updated in SmartSpace list

Item Created Steps:

  1. Trigger
    CopyData-1.JPG
  2. Get Items
    CopyData-2.JPG
  3. Condition
    CopyData-3.JPG
  4. Condition = Yes
    CopyData-4.JPG
  5. Condition = No
    CopyData-5.JPG

Part 2 coming up in a few minutes.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

@Anonymous

 

Part 2. This includes all the output after a new item is created in the SmartSpace list, which then creates the pertaining new item in the Staging list.

  1. Get Items - Item Created Inputs
    CopyData-6.JPG
  2. Get Items - Item Creatd Outputs
    CopyData-7.JPG
  3. Condition
    CopyData-8.JPG
  4. Condition = Yes - Inputs
    CopyData-9.JPG
  5. Condition = Yes - Outputs
    CopyData-10.JPG

Part 3 will be up in a few minutes.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

@Anonymous

 

Part 3. This includes all the output after an existing item is modified in the SmartSpace list, which then updates the pertaining item in the Staging list.

  1. Get Items - Item Update Inputs. See step 1 image from Part 2.
  2. Get Items - Item Update Outputs
    CopyData-11.JPG
  3. Condition
    CopyData-14.JPG
  4. Condition = No - Inputs
    CopyData-12.JPG
  5. Condition = No - Outputs
    CopyData-13.JPG

Please check out all 3 posts and let me know the outcome after you test it.

 

Regards,

Fausto Capellan, Jr

 

 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,179)