cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aysan
Helper III
Helper III

Update SharePoint List items with new value

Hello,

I need to provide a solution for a business request,

 

There is a Sharepoint List that already has more than 400 items; one of the fields on the list is a drop-down field with multiple-choice options, called clients. I need to rename one of the values in the drop-down list due to a Client name change,

For instance, in the test list, I need to rename "Client C" to the new name "Client CC" and keep all the other values intact.

 

Aysan_0-1635295544717.png

The flow gets the items from the list with filter query on the "Client C" 

Aysan_1-1635296040468.png

I am facing an issue when I want to update the list item, it removes all other clients as well

 

Any help is much appreciated

 

Aysan

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @Aysan,

 

Yes, I think this would be possible if you would collect the existing values from the Get items query and replace it. 

 

Below is an example of that approach.

 

In this example I have added the new Client CC name as a separate option in the Clients Column.

 

addnewoptiontocolumn.png

 

The whole flow would look like below. In the Get items I am still using the filter query you were using.

 

filterarrayapproach.png

 

1. After the Get Items I have placed a filter array. The filter array uses the clients field. Which will force the action to be placed in a loop. I am excluding the Client C, because we don't want to update the item with that old value.

 

2. Add a Select action. This is to only select the labels of the select choice options. It is using the body of the filter array and in the map it using the value column:

item()['value']

 

3. Add a Send an HTTP request action to update each item via the validateUpdateListitem method. It uses the ID field to update the correct list item.

 

In the body it is using the following expression to collect the old choice values and add the end we are adding the new Client CC value.

 

join(body('select'), ';#')

 

 

Hi @Expiscornovus , Thank you so much for taking the time and replying to my question, I am facing an issue on my end, when I add the filter array step, the flow starts a apply to each loop ( which makes sense)

buy as soon as I add clients value in starts a new apply to each loop 

 

Aysan_0-1635361778583.png

 

Expiscornovus
Super User
Super User

Hi @Aysan,

 

Can you remove the apply to each and the filter array actions? When you start over please add the filter array and add the Clients field in the from field first. When you add it in that order that should avoid another loop. After that you can add the Clients value field in the filter part.

I started a new flow and it`s the same reaction, as soon as I select the Client value it starts a new loop 😞 

Aysan_0-1635368998883.png

 

added clients to the from the field and the first loop started

Aysan_1-1635369105977.png

 

selecting Clients value here 

Aysan_2-1635369183507.png

as soon as I click on client value the new loop starts

Aysan_3-1635369234148.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,744)