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

Copying between two lists

I need to copy data from one list to another on two different SPO sites.

I'm running into an issue with the fact that two of the columns in the source list are multiple choice columns, one (column A) has 3 built in options, while the other (Column B) is a look-up from another column.

 

I used this procedure to create the flow

https://flow.microsoft.com/en-us/blog/copying-using-filtering/

 

However the issue I run into is that the flow creates a new entry for each of the multiple chice columns so instead of bringing over 1 entry.

so if i have an item with 2 selections in column A and 3 in Column B i get 5 items in the destination list.

2 REPLIES 2
Highlighted
Community Support Team
Community Support Team

Re: Copying between two lists

Hi @Anonymous,

 

Could you please share a screenshot of your flow's configuration?

Further, could you please show a bit more about your two SharePoint lists (Source list and destination list)?

 

I have created two SharePoint lists on my side and the data structure of them as below:

SourceLists:2.jpg

Note: Column A is a Choice type column with 3 built-in options, Column B is a Lookup type column.

 

DestinationLists:3.JPG

Note: Column A(Copy) and Column B(Copy) are both Single line of text type column.

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When an item is created or modified" trigger, specify Site Address, List Name set to SourceLists.
  • Add a Variables-> "Initialize variable" action, Name set to ColumnAValue, Name set to String and Value set to empty.
  • Add a Variables-> "Initialize variable 2" action, Name set to ColumnBValue, Name set to String and Value set to empty.
  • Add a "Apply to each" action, input parameter set to Column A dynamic content of the trigger. Within "Apply to each", add a "Compose" action, inputs set to following formula:
concat(items('Apply_to_each')?['Value'],', ',variables('ColumnAValue'))

Add a "Set variable" action, Name choose ColumnAValue and Value set to output of "Compose" action.

 

  • Under "Apply to each" action, add a "Apply to each 2" action, input parameter set to Column B dynamic content of the trigger. Within "Apply to each 2" action, add a "Compose 2" action, Inputs set to following formula: 
concat(items('Apply_to_each_2')?['Value'],', ',variables('ColumnBValue'))

Add a "Set variable 2" action, Name choose ColumnBValue and Value set to output of "Compose 2" action.

 

  • Under "Apply to each 2" action, add a "Get items" action, specify Site Address and List Name set to DestinationLists. Filter Query field set to following formula:
Title eq 'Title dynamic content of the trigger'

4.JPG

  • Add a Condition, click "Edit in advanced mode", type the following formula:
@equals(length(body('Get_items')?['value']), 0)
  • Within "If/yes" branch of Condition, add a "Create item" action, specify Site Address and List Name set to DestinationLists. Title field set to Title dynamic content of the trigger, Column A(Copy) field set to ColumnAValue variable, Column B(Copy) field set to ColumnBValue variable.
  • Within "If/no" branch of Condition, add a "Apply to each 3" action, input parameter set to output of "Get items" action. Within "Apply to each 3" action, add a "Update item" action, specify Site Address and List Name set to DestinationLists. Id field set to ID dynamic content of "Get items" action, Title field set to Title dynamic content of the trigger, Column A(Copy) field set to ColumnAValue variable, Column B(Copy) field set to ColumnBValue variable.

 

Image reference:

5.JPG6.JPG7.JPG8.JPGThe flow works successfully as below:9.JPG

 

10.JPG

 

11.JPG

 

12.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.
Anonymous
Not applicable

Re: Copying between two lists

This is incredibly useful and it does work to bring the content over for those fields without creating additional items.

The only downside is that those items are in a single line of text field and I need to be able to sort/filter by each option that comes over, maybe there is a formula way to convert it. once its in the destination list.

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

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 (4,463)