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 / How to iterate custom ...
Power Automate
Unanswered

How to iterate custom object?

(0) ShareShare
ReportReport
Posted on by 6
I have a custom object with key value pair data, now i want to iterate it, but i can't do it.
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    Lets say you have an object like so:
     
    {
      "Name": "John Doe",
      "Age": 30,
      "Email": "johndoe@example.com",
      "Address": {
        "Street": "123 Main St",
        "City": "New York",
        "ZIP": "10001"
      },
      "PhoneNumbers": ["123-456-7890", "987-654-3210"],
      "IsActive": true
    }


    In PAD it might look like this in Input Variable:



    Then you use the Key name to refer to tha value you want. So the text under the Name column (in my picture they would be: Name, Age, Email, Address, PhoneNumbers, IsActive)

    So in my example if you want the Age then use %ObjectVariable['Age']%
    If you want to access first Phone number then %ObjectVariable['PhoneNumbers'][0]%

  • Ayat Profile Picture
    6 on at
    yes you are correct, but i don't want to fetch by name, bcs lenth isn't fixed, may i have lot of values, it is difficult fetch all data by name, i have to iterate, then how can i iterate??
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    I am not sure what you are asking. Show example screenshot of the data you want to iterate and what value you want to get out of it.

    Are you asking that if you had multiple different items in that like this:
    {
          "Name": "John Doe",
          "Age": 30,
          "Email": "johndoe@example.com",
          "Address": {
            "Street": "123 Main St",
            "City": "New York",
            "ZIP": "10001"
          },
          "PhoneNumbers": ["123-456-7890", "987-654-3210"],
          "IsActive": true
        },
        {
          "Name": "Jane Smith",
          "Age": 27,
          "Email": "janesmith@example.com",
          "Address": {
            "Street": "456 Elm St",
            "City": "Los Angeles",
            "ZIP": "90001"
          },
          "PhoneNumbers": ["555-123-4567"],
          "IsActive": false
        },
        {
          "Name": "Mike Johnson",
          "Age": 35,
          "Email": "mikejohnson@example.com",
          "Address": {
            "Street": "789 Oak St",
            "City": "Chicago",
            "ZIP": "60601"
          },
          "PhoneNumbers": ["333-789-6543", "222-555-7777"],
          "IsActive": true
        }
     
    So if I create a custom object from that:


    It looks like this:

    and if I press "more" it will give the custom object like so:


    Then you just put that JSONAsCustomObject inside a for each loop so it loops through them one by one:
  • Suggested answer
    Ayat Profile Picture
    6 on at
     
    you can see, i am getting error, my custom object dynamic, i want to iterate it
  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    I cant figure out a simple way to do that since I don't think they are meant to be looped like that. When ever I use custom objects I will know the names of the keys. Why not just create a list or data table where you add the values to? Those would be easy to loop.
     
    You could create a list that you insert the keys into and then loop that keys list. Then inside the loop you can reference the custom objects key to get the value like so:


    If the keys are just 0, 1 , 2 etc you could use LoopIndex but change them to text:

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard