cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ykguler
New Member

Apply to each creates multiple records

Hello, 

 

I have a list of projects in a list, and from there I want to create a team (team name is the project name) in Microsoft Team. But in order to stop it from creating multiple teams with the same name, I am getting the list of teams and checking if it is equal to the project name. 

 

So how I do this is get the list of names and apply for each a condition and if true create a team. But because "create a team" is within the apply each I get multiple teams created within the apply each. What I want is if the conditions are met get out of the loop and move on to the next step (outside the apply to each) and create a team. 

 

Thank you for your help,

Yiğit

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ykguler,

 

Ok, I get it. So you want to confirm the team whether exist, not list.

You could initialize an integer variable before the loop named Flag, set it to 0.

Then loop the list of teams, if there is the same name list exist, set the variable to 1.

After the loop, check the Flag variable whether is 0, if it still is 0, create a new team, or terminate. 

For example:

Annotation 2020-08-14 132219.jpg

 

Annotation 2020-08-14 132220.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Jcook
Super User III
Super User III

Hello @ykguler 

 

Could you share a screenshot of your flow


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi @Jcook, first I get the list of teams and check if there are any teams with the name of the projectFirstFirstThe following create team used to be inside the if yes box, I removed it but haven't tried it yet. 

secondss.PNG

v-litu-msft
Community Support
Community Support

Hi @ykguler,

 

You could use the SharePoint request api get list to confirm the list whether exists in the SharePoint site, if it exists, the get list action will success then do nothing, if it not exists, the Get list request will fail, you could create the list:

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

Annotation 2020-08-14 132217.jpg

 

Annotation 2020-08-14 132218.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft ,

 

I am trying to get the list of existing Teams in Microsoft Teams and I already have the option to check it against the list in Sharepoint with the condition. So why would I need to send an HTTP request to Sharepoint? And I am not trying to create a list. 

So let me try to better explain it;

  • a user manually enters items in Sharepoint list. This list has a Yes/No column (confirmed field) for each item. 
  • If the confirmed field of the item is modified to Yes, do the following;
  • Check if a Team in Microsoft Teams has been created already, new teams will be created using the project name (this is because this runs every time an item is modified)
  • If the Team with the same name is already created; terminate
  • If a Team is not created; create one with team name as project name. 

The problem is the last step was within the apply to each area, which checked if the Teams existed, so what happened is whenever each loop finished and the condition was met a new team was created, so basically I had 5 teams (not equal to project name) already opened in Microsoft Teams so I got 5 Teams with the same name until the apply to each got to the new team created with the project name.

Hi @ykguler,

 

Ok, I get it. So you want to confirm the team whether exist, not list.

You could initialize an integer variable before the loop named Flag, set it to 0.

Then loop the list of teams, if there is the same name list exist, set the variable to 1.

After the loop, check the Flag variable whether is 0, if it still is 0, create a new team, or terminate. 

For example:

Annotation 2020-08-14 132219.jpg

 

Annotation 2020-08-14 132220.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,072)