Power Automate | Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations

Let’s take a simple use case where you need to have a Microsoft Team created in Teams and have the Project Members added to the Microsoft Teams’ Project Team. You can simply do this using 2 simple Flows in Power Automate

Scenario & Setup in Power Automate

If you are a PSA Customer, you would want to create a Team in Microsoft Teams based on what Project it is and then add Team Members of the Project as Team Members in the Microsoft Teams’ Team you created.

Power Automate, create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations
Create a PSA Customer in Power Automate


Let’s look at a Simple example of how you can do this. And further, you can enhance the implementation yourselves based on whether a Project becomes Inactive, or someone is to be removed from the Project Team.

I’ll be creating 2 Flows for this purpose –

  1. One that will create a Team in Microsoft Teams upon Project Creation and
  2. Other, will add Member to the Project’s MS Team upon addition of the Team Member in Project in PSA/Project Operations.

Create a Team for the Project

Let’s look at the first scenario where you can create a Team in Microsoft Teams once create a Project in PSA.

  1. Flow to trigger off of a creation of a Project.
    |
  2. Now, search for create a team in the next step to find a Microsoft Teams connector’s Action to create a Team in Microsoft Teams.

  3. Assign the Name of the Project and Description of the Project for easy understanding. You can make the team Private which is ideal to keep users’ Teams cleaner and also keeps Project discussions isolated if that’s the need.

  4. Once a Team is created, I’ve created a field on Project record to hold the MS Teams’ ID for other references.

    Add a step to update the Project back with the created MS Teams’ ID like this

    And in that, I’ll update the Created Team’s ID
  5. Now, fetch the Project Manager’s User record in CDS (PSA, basically) so that the User’s ID can be used to make the Owner of the Team you are creating.
  6. Next, you need to add Members to the Team. Look for add a member to the team and you’ll find Microsoft Teams’ action which you can use.
  7. Here’s how the Add a team member looks like.
  8. Now, this is a little tricky. Since you don’t get the Dynamic Values right away in this Action, click on Add a custom item.
  9. In Add a custom item, you can add the Team ID of the MS Team you just created for the Project in step #3 above.

    Once you add it, it’ll look like below
  10. And for the User’s AAD ID step, set the System User’s (fetched in #5)

    Add Azure AD Object ID
  11. Now, the last step looks set.

Add Members to the Project Team in Power Automate

Let’s work on the other scenario with other Flow. This will be on trigger of a creation of a project Team Member.

  1. This second will fire off on creation of a Project Team Member. Hence, the trigger on Create of a Project Team Member.
  2. I’ll get the Project record since I need the MS Teams ID which is a custom field we created to store the MS Team’s ID on the Project.

    Again, you can do this easily if you know how to get related records. I’ve done an extra step for simplicity.

  3. Now, the next step is to retrieve the Bookable Resource‘s Record. In turn, we’ll retrieve the System User record associated with the Bookable Resource record on the Project Team so that the System User’s ID can be used.
    Just because I need the Azure AD Object ID (User) entity, I’ve written a fetch XML on the Bookable Resource entity to go and get the User record’s Azure AD Object ID. I’ll need this to map it in the step where we’ll add the Member to the Project’s created Team.


    My step to retrieve Bookable Resource + System User’s Azure AD ID looks as below. Make sure you select the Bookable Resource GUID reference from the trigger i.e. the Creation of the Project Team Member record to ensure we only get 1 record.
  4. Then, I’ll simply generate a Parsed JSON after the above Step so that I can get to select the required attribute to select in the Team’s Add a Team Member step (Because the related field is not available for Dynamic Values) (In case you know how to directly write using outputs() function, that should be good enough too!!)

  5. Now, add the Team Member to the Project’s Team in MS team. Again, as mentioned above in the previous Flow, use the Add a member to a team Action from Microsoft Teams connector to do so.
    Now, add the Team’s ID in the Team field.

    On the Team field, you’ll need to Add a custom Value like we did in the previous Flow.


  6. And for the final step, in the User AAD ID for the user to add to a team step, you can pick the parsed Azure ID field from #4 above.
  7. As soon as you select from Parse, the Flow step will be converted to Apply to each. But that’s because we used List records which returns multiple values. Even though Apply to each is applied, this will logically run only once anyway!!
  8. Now in the user AAD

Working

Now’s let’s see all this in action.

  1. Let’s create a Project in PSA. Notice I’ll enter the name and the Description since we are creating a Team in MS Teams and that’s what we are filling out. Notice that MS Teams Project ID is blank. Our Flow will populate that once a Team is created in Microsoft Teams.
    Notice that Joe Danny is the Project Manager on the Project, he will be the Owner of the Team we are creating in MS Teams as per our first Flow.

  2. A Team like this will be created in Microsoft Teams.
  3. Also, notice that in the Project in PSA, a MS Teams Project ID will be populated too.
  4. Also, notice that Joe Danny is the Owner of the Team since Joe is the PM on the Project.
  5. Now, let’s add 1 more Team Members to the Project in PSA. Now, I’ve added a new Team Member Priyesh in the Project’s Team.

  6. That team member also get added as Members in Microsoft Teams in the Project’s Team. This is from out second Flow we created to add the Team Members to the created Teams for a PSA Project.

Here are some more enrichments you’ll need to do to handle some scenarios –

  1. Separately handle if a Project is Canceled/Deactivated for some reason.
  2. Remove Members from an MS Teams if they are removed from the Project.

Hope this was useful.

Here are some more posts about Project Service Automation (PSA) in Dynamics 365 / Microsoft Teams that might be helpful –

  1. Cancelled Bookings Imported in Time Entries in Dynamics 365 PSA issue | [Quick Tip]
  2. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate
  3. Change Booking Status colors on Schedule Board for Field Service/PSA [Quick Tip]
  4. Additional columns in PSA v3 Schedule view
  5. Check Managed Solution failures in Solution History in Dynamics 365 CRM
  6. Modify Project tab’s view in Schedule Board in PSA v3 | Quick Tip
  7. Update Price feature in D365 PSA v3
  8. A manager is required for non-project time entries, absence, and vacation error in D365 PSA v3
  9. Time/Expense Entry Rejection comments in D365 PSA v3
  10. PSA v3 View Custom Controls used on Project form

Thank you!!

For more Power Platform news, check out Power Platform week.

About the Author:

I’m a Microsoft Business Applications MVP working with CloudFronts Technologies Pvt. Ltd. as a Dynamics 365 Sales/PSA Consultant in Mumbai.

Growing fond of Microsoft Dynamics 365 & Power Platform by each passing day and having the urge to explore deeper!

Reference:

Wagh, P. (2020). Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate. Available at: https://d365demystified.com/2020/12/07/create-a-team-add-members-in-microsoft-teams-upon-project-and-team-members-creation-in-psa-project-operations-power-automate/ [Accessed: 11th January 2021].

Share this on...

Rate this Post:

Share: