copy list itmes column value to another column sharepoint online

Brass Contributor

Hi,

 

I have one list library where i have one column Called Status and another Status_archive

 

i want to copy value of status column to status_archive column whenever new item get added to list or any modification in status column value.

how i can do this?using MS flow?

and how i can update old data?

12 Replies

@rautchetan27 these 2 requests can be done with a couple of very simple flows in Power Automate.

 

1) When an item is created or modified. That will be your trigger and then you just update the item that was created or modified and into the StatusArchive field you select Status from the dynamic content box:

 

1-itemCreatedModified.png

  

2) To do this for all existing items in your list, use a trigger of Manually trigger a flow. 

 

2a-triggerGet.png

 

By default Get items only returns 100 items, so if your list has more than this go to the settings for the Get items, switch on Pagination and set the threshold to 2000.

 

2a-paginationThreshold.png

 

Then add a SharePoint Update item action and select the ID and Title from the dynamic content box and then for the Status Archive field select Status as you did at 1) above. As you are entering the fields the action will wrap itself in an apply to each control which is what we want.

 

2b-ApplyUpdate.png

 

The flow will loop through each item in the list and copy the value in each Status column to the StatusArchive column.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

 

Thanks! will it work if both Column type is Choice? will it able to copy choice from one column to another?

@RobElliott 

 

Hey Rob,

 

I saw this post here with your suggestions and this is something similar to what I am working on . Unfortunately, it's not working out very well for me. This is the fist time I am using Power Automate. I am in the process of recreating my SharePoint Workflows from SharePoint 2010/2013 . With that being said I could use your assistance. 

 

I am following your 1st suggestion here . I have a Project Notes Field that has versioning turned on. I am trying to copy the most recent Project Note to another field called Current Status. Purpose of the Current Status field is so that it will only show the Most Recent version on Notes from the Project Notes field.

 

Here's what I am doing.

Step 1. When and Item is created or modified

Step 2. Update Item 

  • ID:  ID
  • Title: Tile
  • Current Status Field:  Project Notes

This is what is happening:

When in the Sharepoint list - I am no longer able to save cause it is locked to a user. So it's not closing out. 

In Power Automate I get this warning:

Actions in this flow may result in an infinite trigger loop. Please ensure you add appropriate conditional checks to prevent this flow from triggering itself.

 

Thanks in advance for your assistance:

Rob Ayala

 

@Rob_Ayala you will always end up with an infinite loop with your steps 1 and 2. If you are looking at whether 1 or more specific columns have been changed then your trigger should be "When an item or a file is modified". You then need a "Get changes for an item or a property (properties only)" action and in the Since field add the following expression:
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)

 

Next add a condition and in the left box select Has Column Changed: Department is equal to true. (you'll select your own column).

 

Leave the red If no channel empty and in the green  if yes channel and an update item and up the other columns that you want updated, i.e not Department in my case.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

 

Rob,

 

Thank you for your quick response. I really appreciate it.

So I did exactly what you said. Unfortunately, it did not accept the expression. This is what I got.

 

Rob_Ayala_0-1623425958340.png

 

This is the whole flow....

 

Rob_Ayala_1-1623426413540.png

 

Thanks,

Rob

Your condition is incorrect: you have used an expression for true which is wrong, all you need to do is type true in the box.

@RobElliott 

 

Hey Rob,

 

After changing the condition to just state 'true'  as the value, I still got the following 

 

Rob_Ayala_0-1623439981513.png

 

Thanks,

Rob

@Rob_Ayala You need to enter that code in the popup to the right for the Since field, where it says "Expression":

willscarbrough_0-1623947352077.png

 

When complete it will look like this:

willscarbrough_1-1623947393672.png

 

Awesome!!! That did it. Thank you @willscarbrough and @RobElliott ....

 

Thanks again for all your help,

Rob 

@RobElliott can you update a look up column with a single text column? 

Soory, I don't understand your question.
I’m trying to create a flow to update a lookup column with the value from a single text column