web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Improve performance in...
Power Automate
Unanswered

Improve performance in a flow

(0) ShareShare
ReportReport
Posted on by 90

Hello everyone,

I have tried to find an answer to a problem and I am beginning to think that there is no solution. I share the situation with you:

It involves removing all permissions from a sharepoint list and then giving permissions again based on a condition from another list.
First I get the elements of the two lists: LISTA_PRUEBAS and PERFIL

Dibujo1.png

then in the first loop I loop through the first list and remove all permissions. And then in the second nested loop I include the condition if the Terr field is equal to AREA then I add the permissions that I have defined in the PERFIL list with the GESTOR field

Dibujo2.png

The problem I'm having is that this flow takes 13 hours to run.

The first list has 20,000 records and the second about 15.

The question is: do you see anything that could improve performance? Could it be done by programming the SharePoint API and make it faster?

Thank you very much for your help

Categories:
  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @Segu1 

    For your second loop, you should be using a filter query rather than a condition.

    This blog post will explain filter queries.

    In addition, you will likely improve performance if you use a Logic App rather than a Flow but that may be costly if you run this all the time.

     

     

  • SeguM Profile Picture
    90 on at

    Thank you very much for the response, ScottShearer

    But I would need the filter to allow me to filter with an equal, That is, the Area is equal to Ter. But it does not appear as a dynamic element to be able to do so. How should I do this, taking into account that in my condition we are working with two lists?
    Thanks!



  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    In your filter expression, just select the element that you want from Dynamic properties.

     

     

  • SeguM Profile Picture
    90 on at

    Hello Scott Shearer.

    The problem continues to be time. It takes too long. I think the solution is to do this with a batch process with the sharePoint API, unfortunately I lack specific knowledge. So I'll ask the community if anyone can help me with this in another post.

    Thank you very much for the help.
     

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @Segu1 

    The bottom line is that you are looping through 20,000 records and that is going to take a long time.  I don't believe that calling the API will do much for you because that is exactly what Power Automate is doing under the covers.

    You probably want to re-think how you are doing things.  Maybe changing your logic such that a Flow runs when an item in one of the lists is created or modified.  I don't know your business process, so I can't be more specific.

    If you detail why you are doing this and explain your business process, I (or others) might be able to make some suggestions.

  • SeguM Profile Picture
    90 on at

    Hello Scott,

    The basic problem is that I have to profile a sharepoint list of 20,000 records according to a specific field. When that field matches the same field in another list, I must give write permissions.

    In the process what I am doing is breaking inherited permissions from the site, removing all permissions in the list and then giving write permissions to each item (from 2 to 12 users depending on the item).

    I ran the test for 1045 records and it took 1 hour and 33 minutes.

    I don't know if working with batches could improve times, that's the question.


    That's because I already did the previous combination so I didn't have to do the double loop! 
    😰

  • VictorIvanidze Profile Picture
    13,083 on at

    Hi @Segu1,

    the task is quite difficult and time consuming. I doubt anybody will spent a lot of time  to redesign your flow for free. Just hire somebody who can implement  the batch process. 

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @Segu1 

    Is there any reason that you can't use groups?

    Grant write permissions to the group.  When the need arises, just remove group members and add new members.

  • SeguM Profile Picture
    90 on at

    In both cases you are right, but in response to Scott, I cannot work with groups and I don't think I can in the near future.

    And responding to Victor. In fact, I should hire someone to redesign the flow, but I think before doing so I'm going to try it myself. The initial question was not about having the flow made for me for free, but rather the opinion of whether, for example, with a process batching could make it more efficient. Since everything indicates yes, then I will invest my time in development.

    Thank you both very much for the response and help. 🙂

    Greetings from Galicia, Spain


  • VictorIvanidze Profile Picture
    13,083 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard