cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cweaver
Advocate II
Advocate II

SharePoint When an Item is Created or Modified Issue

Hello All,

I'm new to Power Automate; I arrived at a need for it after getting my feet wet with PowerApps. I have several SharePoint (SP) lists that I am looking to automagically update based on changes/additions to a master SP list. My master SP list has all US cities and towns (>37,000 items) with each city having additional columns including:

  • 6-character alphanumeric unique city identifier
  • abbreviated state name (AK, AL, AR, etc.)
  • county
  • a couple other columns that are specific to my work

I have 51 SP state lists with the same column names and format as the master SP list. These individual lists will ultimately have more columns once I get the flow working correctly. My intended flow automation is that whenever a city line item is modified in the master SP list, the same line item in the respective state SP list will also be updated (if I update the Albuquerque, NM master SP line item, I want the Albuquerque line item in the NM list to also update). If it helps, the only column data that really ever changes per line item in my use case are the columns that are specific to my work; the alphanumeric city identifier stays the same. Additionally, if I need to add an item to the master SP list, I want that item to show up in the respective state SP list. I've been able to accomplish the first part of my goal: changing line items in the master SP list, only updates the respective state SP list, but I can't manage to get new entries to the master SP list to populate in the respective state SP lists. Here is what I have tried so far for the AK flow:

Annotation 2020-08-11 141042.png 

The condition after my filter array is:

length(body('Filter_array'))

I've tried many options for the If No condition, but none of them seem to work; I usually end up having to cancel the flow as adding 1 new AK entry to the master SP list won't stop creating line items in the AK SP list. I'm ok with having to copy the flow I have here (once it works as expected) and modifying for each of the states. I'm not sure if what I have here is even the best approach to my end goal, and I am open to any suggestions if I need to start over. What am I missing?

2 REPLIES 2
haroldbk_msft
Community Support
Community Support

With so many lists and items this could be a very inefficient flow. 

Assuming when you update the master list you will then have to find the correct state list.

you could use Sent an HTTP request to SharePoint to get the list filtered by the State value in the trigger.

Then Parse Json using the body of the HTTP request

Iterate the results of that action to find the a match where the title in the results equals the City in the updated item.

From there get the ID of the item in the State list

Finally, do another Send an HTTP request to SharePoint to update the item.

haroldbk_msft_2-1597183498603.png

 

I attached a sample flow 

@haroldbk_msft, thanks for taking a look at this and helping me. I should add a point of clarity regarding my use of the SP lists in that the master SP list will be updated at most twice a year (if even that often), but I need the individual state SP lists to be exact clones of the individual state portions of the master list the instant (or very, very shortly after) the master list is updated. In testing my flow, its runtime in each of my successful test instances (where I was only modifying both AK and non-AK items in the master SP list) is only 1 sec <edit: or less in testing and running the above flow for 2 different states>. You mention an interesting point about finding the correct state list after updating the master list. Did you mean manually finding the correct state list? If so, the flow in my OP does, at least in testing, update the correct state SP list. My only issue with the original flow is the inability to successfully push brand new entries from the master SP list to the state SP list.

 

I did try to implement your flow, but as I'm just as new to JSON as I am to Power Automate (read as a couple days old), I'm able to modify your flow for every aspect of my SP files and dynamic content except the last part of Send an HTTP Request to SharePoint 3 where "fruit" is referenced both in the JSON code and as a dynamic value; I'm not sure what to do with that one?

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (80,980)