cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeroenft
Regular Visitor

Auto create teams page if not existing already with teams list

Hi,

 

I want to create a teams page based on a sharepoint list input (customer name, location and project number). The trigger is when a list item is created and information is entered. After that the flow must check if the teams page already exists for that specific customer name. If not it needs to create a teams page, if it exists it  needs to create a channel with the "location - project number" as the channel name. 

 

I am however stuck that for every false value a new teams page is created, how can I check if the name of a customer already has a teams page and if not only create 1 teams page.

 

below the first draft of the flow:

jeroenft_0-1662641285717.png

Thanks, Jeroen

1 ACCEPTED SOLUTION

Accepted Solutions
Caspar_Rubin
Solution Supplier
Solution Supplier

Hey, 

 

I would do it like this: (You have to loop [apply to each] Channels as well, not only Teams...)

 

Create a string variable (Initialize variable action) called something like "TeamAlreadyExists" and set the value to No.

 

Then get all Teams with the "List Teams" action.

Then you have to also use the "List Channel" action inside your loop to list all channels inside all Teams.

Inside that loop you then have the Condition action where you check if the Channel Name contains the Customer's Name = the dynamic value from your trigger at the top of you flow. Make sure you use "contains" as the operator, not "is equal to" in this condition!

 

In the "If yes" section, you use the Set variable action to set the variable "TeamAlreadyExists" to Yes, if it finds a team where the condition is true.

 

Now, below all that, once the flow looped through all your teams and channels, you add a new Condition action.

In this Condition action, you check if the variable "TeamAlreadyExists" is still equal to No.

 

If that's the case (If yes) then you create the Channel using the Create a channel action.

 

If it is set to Yes, you know that there was a Channel in there somewhere that set the Variable TeamAlreadyExists to Yes and the Channel already exists.

 

Caspar_Rubin_0-1662660116182.png

 

let us know if this works,

cheers

 

View solution in original post

1 REPLY 1
Caspar_Rubin
Solution Supplier
Solution Supplier

Hey, 

 

I would do it like this: (You have to loop [apply to each] Channels as well, not only Teams...)

 

Create a string variable (Initialize variable action) called something like "TeamAlreadyExists" and set the value to No.

 

Then get all Teams with the "List Teams" action.

Then you have to also use the "List Channel" action inside your loop to list all channels inside all Teams.

Inside that loop you then have the Condition action where you check if the Channel Name contains the Customer's Name = the dynamic value from your trigger at the top of you flow. Make sure you use "contains" as the operator, not "is equal to" in this condition!

 

In the "If yes" section, you use the Set variable action to set the variable "TeamAlreadyExists" to Yes, if it finds a team where the condition is true.

 

Now, below all that, once the flow looped through all your teams and channels, you add a new Condition action.

In this Condition action, you check if the variable "TeamAlreadyExists" is still equal to No.

 

If that's the case (If yes) then you create the Channel using the Create a channel action.

 

If it is set to Yes, you know that there was a Channel in there somewhere that set the Variable TeamAlreadyExists to Yes and the Channel already exists.

 

Caspar_Rubin_0-1662660116182.png

 

let us know if this works,

cheers

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,212)