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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow endlessly running...
Power Automate
Unanswered

Flow endlessly running - help!

(0) ShareShare
ReportReport
Posted on by 28
Hey everyone
 
I'm reaching out for some help - I have created a flow which is the following:
 
  1.  Trigger when a form is submitted
  2.  Scope - Copy Excel and reset
    1. Get file content of excel document that user fills out
    2. Compose New file name
    3. Create new folder
    4. Create new excel file of file that user fills out within new folder
    5. Delay 5 seconds
    6. Delete original file that user fills out
    7. Create copy of template excel document and puts it in original place for user
  3. Scope Excel
    1. List rows present in table - this is looking at new copied file
    2. Filter array with the filter of @and(not(empty(trim(item()?['Code']))), not(empty(trim(item()?['REF Number']))))
    3. Select action of body of filter array, map trim(item()?['Code'])
    4. Compose UniqueExcelCodes with inputs of union(body('Select_Excel_Code_Strings'), body('Select_Excel_Code_Strings'))
    5. Compose CountExcelCodes with inputs of length(body('Filter_array_Excel'))
  4. Scope Sharepoint
    1. Get Items - gets items in a sharepoint list - in this Sharepoint list there is a code (title column), Key, Start Date, End Date
    2. Filter array from the value of get items, map of @equals(item()?['Key'], 'CD')
    3. Select from value of Get items, map is trim(item()?['Title'])
    4. Compose SPCodeCount with inputs length(outputs('Get_items')?['body/value'])
  5. Initialise Variable
    1. Name = RowIDs
    2. Type = Array
    3. Value [1,2,3,4, ... , 100] - there are 100 rows in the excel document
  6. Compose MatchExists with the inputs of greater(length(intersection(body('Select_SP_Code_Strings'), union(body('Select_Excel_Code_Strings'), body('Select_Excel_Code_Strings')))), 0)
  7. Apply to each with the outputs of Compose UniqueExcelCodes
    1. Condition - output of Select from value of Get items contains Apply to each
      1. No = send email as there is no match of codes
      2. Yes = Apply to each 2 of Filter array from the value of get items
        1. Condition - items('Apply_to_each_2')?['Key'] equals CD, AND, formatDateTime(utcNow(), 'yyyy-MM-dd') > formatDateTime(items('Apply_to_each_2')?['EndDate'], 'yyyy-MM-dd')
          1. Yes = send email as the date in the sharepoint list is in the past
          2. No = Apply to each 3 with the outputs from List rows present in table (from scope Excel)
            1.  Scope - nothing inside. Underneath this scope is 2 actions running parallel
              1. Filter array DisneyYES from value of List rows present in table, toLower(trim(items('Apply_to_each_3')?['Disney?'])) = yes
                1. Condition - length(body('Filter_array_DisneyYES')) > 0
                  1. Yes = Apply to each 4 of body of filter array DisneyYes
                    1. Scope Task Creation - DisneyYES
                      1. Create new folder 1
                      2. Create sharing link for folder 1
                      3. Create new folder 2
                      4. Create sharing link for folder 2
                      5. Create new folder 3
                      6. Create sharing link for folder 3
                      7. Get file content (finds blank powerpoint file on sharepoint)
                      8. Create file (based on this powerpoint file)
                      9. Create sharing link for new powerpoint file
                      10. Get items CD Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'CD'
                      11. Get items DSO Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'DSO'
                      12. Get items AW Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'AW'
                      13. Get items PR1 Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'PR1'
                      14. Get items REP Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'REP'
                      15. Get items PR2 Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'PR2'
                      16. Get items FCR Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'FCR'
                      17. Get items VR Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'VR'
                      18. Compose CD Date with inputs of first(body('Get_items_-_CD_Date')?['value'])?['EndDate']
                      19. Compose DSO Date with inputs of first(body('Get_items_-_DSO_Date')?['value'])?['EndDate']
                      20. Compose AW Date with inputs of first(body('Get_items_-_AW_Date')?['value'])?['EndDate']
                      21. Compose PR1 Date with inputs of first(body('Get_items_-_PR1_Date')?['value'])?['EndDate']
                      22. Compose REP Date with inputs of first(body('Get_items_-_REP_Date')?['value'])?['EndDate']
                      23. Compose PR2 Date with inputs of first(body('Get_items_-_PR2_Date')?['value'])?['EndDate']
                      24. Compose FCR Date with inputs of first(body('Get_items_-_FCR_Date')?['value'])?['EndDate']
                      25. Compose VR Date with inputs of first(body('Get_items_-_VR_Date')?['value'])?['EndDate']
                      26. Compose CD Date with inputs of first(body('Get_items_-_CD_Date')?['value'])?['EndDate']
                      27. Compose CD Date for Taskcard with the inputs of formatDateTime(first(body('Get_items_-_CD_Date')?['value'])?['EndDate'], 'yyyy-MM-dd')
                      28. Create planner task
                      29. Create item in sharepoint list
            2. Filter array DisneyNO from value of List rows present in table, toLower(trim(items('Apply_to_each_3')?['Disney?'])) = no
              1. Condition - length(body('Filter_array_DisneyNO')) > 0
                1. Yes = Apply to each 4 of body of filter array DisneyNO
                  1. Scope Task Creation - DisneyNo
                    1. Create new folder 1
                    2. Create sharing link for folder 1
                    3. Create new folder 2
                    4. Create sharing link for folder 2
                    5. Get file content (finds blank powerpoint file on sharepoint)
                    6. Create file (based on this powerpoint file)
                    7. Create sharing link for new powerpoint file
                    8. Get items CD Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'CD'
                    9. Get items DSO Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'DSO'
                    10. Get items AW Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'AW'
                    11. Get items PR1 Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'PR1'
                    12. Get items REP Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'REP'
                    13. Get items PR2 Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'PR2'
                    14. Get items FCR Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'FCR'
                    15. Get items VR Date - gets the same items referenced earlier but with a filter query of Title eq '@{items('Apply_to_each_4')?['Code']}' and Key eq 'VR'
                    16. Compose CD Date with inputs of first(body('Get_items_-_CD_Date')?['value'])?['EndDate']
                    17. Compose DSO Date with inputs of first(body('Get_items_-_DSO_Date')?['value'])?['EndDate']
                    18. Compose AW Date with inputs of first(body('Get_items_-_AW_Date')?['value'])?['EndDate']
                    19. Compose PR1 Date with inputs of first(body('Get_items_-_PR1_Date')?['value'])?['EndDate']
                    20. Compose REP Date with inputs of first(body('Get_items_-_REP_Date')?['value'])?['EndDate']
                    21. Compose PR2 Date with inputs of first(body('Get_items_-_PR2_Date')?['value'])?['EndDate']
                    22. Compose FCR Date with inputs of first(body('Get_items_-_FCR_Date')?['value'])?['EndDate']
                    23. Compose VR Date with inputs of first(body('Get_items_-_VR_Date')?['value'])?['EndDate']
                    24. Compose CD Date with inputs of first(body('Get_items_-_CD_Date')?['value'])?['EndDate']
                    25. Compose CD Date for Taskcard with the inputs of formatDateTime(first(body('Get_items_-_CD_Date')?['value'])?['EndDate'], 'yyyy-MM-dd')
                    26. Create planner task
                    27. Create item in sharepoint list
The flow does everything I want it to do, however it hangs and endlessly runs - can someone help me so it doesn't?
 
Thanks guys :)
Categories:
I have the same question (0)
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Which one is still running ? Can you check the history and find the still-running action ?
     
    ChatGPT tells that the first thing you may want to check:
    'Collapse the eight separate “Get items – … Date” calls into one “Get items” outside the loop, then filter that single array in-memory', and do that before  Apply  to each 4.
  • Sphynx2120 Profile Picture
    28 on at
    @stampcoin thanks for getting back to me!
     
    The get items have different codes and dates against them (please see attached screenshot), so I have to list them individually - but I can try putting them outside the apply to each
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Thanks for the extra info, I am pretty sure put a filter before the loop will reduce the api invoke against your sharepoint list.
    please try that, use a variable if need ( maybe more friendly).
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard