cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mescwb
Frequent Visitor

error - foreach - result must be a valid array

Could someone enlighten me? Appreciate it... quite simple flow with only 1 action and 2 foreachs over it...

fails at the 1st item in the foreach

 

ps: "equipe" = team in portuguese, and this tiny flow of mine was based on the initial part of this tutorial Export Planner to Excel using Power Automate

 

ps2: never understood why "Get all teams" action returns "lists" (plural) of teams and, whenever we add a foreach on TeamIDs right after, flow editor "automatically" adds a foreach on such Teams "lists" one level up

 

mescwb_0-1624042307923.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
AnthonyAmador
Microsoft
Microsoft

Hi @mescwb 

 

I think you only have to use one "for each" if what you want is the names of all the teams, in my case I make an array and then append each team name. It should look like this.

 

AnthonyAmador_0-1624047937762.png

and yes, the tool automatically puts the "for each" if you need it, it does not detect if you already have a "for each" so in this case add another one inside, but you just have to iterate the "teams list" and look for the team name in this case. 

 

Hope I have understood your problem, in this case don't worry about adding the "for each", just call the dynamic content you need and the "for each" will be automatically added.

 

Hope this helps. 

Regards.

 

 

 

View solution in original post

2 REPLIES 2
mescwb
Frequent Visitor

btw this is the body from the "full" output of the action "Get All Teams":

"body": {
        "@odata.context""https://graph.microsoft.com/v1.0/$metadata#teams",
        "@odata.count"5,
        "value": [
            {
                "id""a913fb38-ac67-4a9a-864f-d8096fbb319e",
                "displayName""DigiGov",
                "description""Governança Digital",
                "visibility""public",
                "isArchived"false
            },
            {
                "id""8b689096-17af-4609-bdec-d9f2f50521f2",
                "displayName""PEDI 2020 Exec",
                "description""Execução plano 2020-2023",
                "visibility""public",
                "isArchived"false
            },
            {
                "id""6b5f30f4-1bfe-44ad-8160-d81a1106ac5a",
                "displayName""Escritório de Processos",
                "description""Escritório de Processos",
                "visibility""public",
                "isArchived"false
            },
            {
                "id""14575e50-68ed-4c59-b272-d0fcf13d92a2",
                "displayName""PDTIC 2021",
                "description""Plano Diretor de TIC 2021-22",
                "visibility""public",
                "isArchived"false
            },
            {
                "id""bc97d685-cc68-460b-806f-0a057e9ffde7",
                "displayName""PMO",
                "description""Escritório e subsites de Projetos",
                "visibility""public",
                "isArchived"false
            }
        ]
    }
AnthonyAmador
Microsoft
Microsoft

Hi @mescwb 

 

I think you only have to use one "for each" if what you want is the names of all the teams, in my case I make an array and then append each team name. It should look like this.

 

AnthonyAmador_0-1624047937762.png

and yes, the tool automatically puts the "for each" if you need it, it does not detect if you already have a "for each" so in this case add another one inside, but you just have to iterate the "teams list" and look for the team name in this case. 

 

Hope I have understood your problem, in this case don't worry about adding the "for each", just call the dynamic content you need and the "for each" will be automatically added.

 

Hope this helps. 

Regards.

 

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,184)