Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Referring to the created [SharePoint List] Item's ID | "nested loop" error

(0) ShareShare
ReportReport
Posted on by 18

Hi All.
So, I am trying to create this flow that runs every night and goes through the uploaded .xlsx files whose `ProcessingStatus eq 'Not Started'`. After the trigger the flows does "get files(properties only)" - that's where I specify the SP Site and Drop/Document Library.

There are Customer, Operating System and Device Tables in the uploaded Excel Workbooks.

The idea is to go over the Customer Table, grab the info, and create a customer item in the Customer List.
Then go over the Operating System table, grab the info, and create an operating system item in the Operating System List.
The next step would be to go over the Device Table and create a device list item.
The problem is: the device list has a lookup into its owner [the customer] and into its operating system - the flow will want me to pass the ID of the respective looked up items - the id of the corresponding customer and operating system items associated with the device. 

However, upon device item creation, I can't refer to the ID of the created customer item and created os item, because I get the error saying I am in a loop. The point is: I do need the loop, since there may be multiple files to process.

I even removed the "apply to each row" action that would sit after "list rows .." and contain the "create item" action, and used an index[just trying the first row only] in the create item actions to try to decrease the number of loops. But that doesn't help either. 

Thanks in advance. 

  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on at
    Re: Referring to the created [SharePoint List] Item's ID | "nested loop" error

    Could you create all of the items for the Customer and Operating System tables.

     

    Then for the Device table basically filter/lookup the Customer and OS value needed for each row and then create the item with those ID numbers.

    So something like this:

    • Get Files
    • Apply to Each - Get Files
      • List Rows in a table - Customer Table
        • Apply to Each 2 - Customer Table
        • Create Item - Customer List
      • List Rows in a table 2 - Operating System Table
        • Apply to Each 3 - Operating System Table
        • Create Item 2 - OS List
      • List Rows in a table 3 - Device table
        • Apply to Each 4 - Device table
        • Get Items - Customer List - Filtered by the Device row data
          • Get the ID for the Customer List Item
        • Get Items - Operating System List - Filtered by the Device row data
          • Get the ID for the OS List Item
        • Create Item 3 - In the Device list and use the Ids from the look up column.
  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on at
    Re: Referring to the created [SharePoint List] Item's ID | "nested loop" error

    I'm wondering why you don't have an Apply to Each for all of the Create Item actions? 

     

    I thought it would look like:

    • Get Files
    • Apply to Each - Get Files
      • List Rows in table - Customer Table
        • Apply to Each 2 - Customer Table
        • Create Item
      • List Rows in a table 2 - Operating System Table
        • Apply to Each 3 - Operating System Table
        • Create Item 2
      • List Rows in a table 3 - Device table
        • Apply to Each 4 - Device table
        • Create Item 3
  • Kelarov Profile Picture
    18 on at
    Re: Referring to the created [SharePoint List] Item's ID | "nested loop" error

    PS: I kinda managed to solve that, but only with a particular row from the tables haha; if I have more records, where I'd then have a "apply to each" row after a list the rows in a table, then it keeps displaying something like "you can't depend on other data having multiple loops", etc.

    I kind of get the tool's reasoning - if I loop through several customers, then I'd have several IDs, so the tool wouldn't know which list item id to refer to at the end of the flow when I just select an "ID". But on the other hand, I can't just start dealing with devices without having processed the customer and the operating systems haha;

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1