Introduction

In this article, we will go through how to update the list column based on requests on other lists. Here I have 2 lists, one is requests and the other is countries.

In the requests list ‘Country’ is a look up column.

Here the property ‘RequestCount’ contains the count of requests based on ‘Requests’ list.

Flow Design

Now we will go through the steps of designing the flow.

Step 1

Login to Power Automate portal (https://make.powerautomate.com) with your organization account.

Step 2

Select the trigger point as SharePoint and select 'On item created or modified'.

Step 3

Get items from the countries list.

Step 4

From the countries list we need ID and the Country names. These are needed to update the list item properties. Here create the JSON object using the ‘Select’ data operation.

Step 5

Create ‘Apply to Each’ and select outputs from previous steps which is Country Names. and inside add ‘compose’ action and log the current item. At first we will get the country value from the current JSON object.

Step 6

Now add ‘Get Items’ and configure the action to get the requests that satisfies the filter query where the current item country equals the country property of the requests.

In the filter query I have updated the property as Country/Title, since country is look up column and it requires specific format to check the filter. More about OData can be found in references section.

And the value is the dynamic outputs of compose action log current item.

Step 7

Now here I am getting the length of collection and checking if the count greater than or equal to 1.

length(outputs('Get_items-Requests')?['body/value'])

Step 8

If the collection has value and go ahead update item with Request count.

Step 9

Below is the complete flow and it should similar to below.

Conclusion

We have seen how to update the requests count on the fly, based on the updates on the other list.

References