Forum Discussion
rautchetan27
Jun 15, 2020Brass Contributor
copy list itmes column value to another column sharepoint online
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?
- RobElliottSilver Contributor
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:
2) To do this for all existing items in your list, use a trigger of Manually trigger a flow.
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.
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.
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- its_tutuCopper Contributor
RobElliott can you update a look up column with a single text column?
- RobElliottSilver ContributorSoory, I don't understand your question.
- Rob_AyalaCopper Contributor
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
- RobElliottSilver Contributor
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
- rautchetan27Brass Contributor
Thanks! will it work if both Column type is Choice? will it able to copy choice from one column to another?