I wish I had enough free time to go over all of the available configurations in Microsoft Flow, but you can do almost anything you would like inside of Microsoft Flow. At the time of this writing there are 95 free services and 32 premium services. The services that will be covered in this article will be Microsoft Dynamics 365 and Microsoft Teams.

Scenario

The following Flow details how to alert a Microsoft Teams Channel every time a Case is created in Dynamics 365. We also alert the different Channels in Teams based on who the Customer on the Case is.

Starting with Microsoft Flow

Creating your first flow is not very difficult, there are really only two options; you either choose to “Create From Template” or “Create From Blank”. The one you choose will depend on the goal you are trying to achieve.  Sometimes you can find a template that does most of what you are trying to do and use it as a starting point, but like always, no one has done exactly what you want. For this example we are going to start with “Create From Blank”.

Creating a Trigger

Every Flow starts out the same, by creating a Trigger. (This tells your Flow when to run) There are Triggers for many different services, most notably for CRM are Create, Update, and Delete. This Flow will run on Create of a Case. To setup the Trigger you need to select “When a record is created” for the Dynamics 365 service, and select the Organization Name and the Entity.

Retrieving Records

When we are alerting the Microsoft Team Channel we want to show information that is not readily available on the Case record (Account Name, Account NumberCreated By User FullName). The records we want to retrieve are the associated Account record and the associated System User record. Retrieving these records will allow us to display any fields from either of those records in any of following steps.

To retrieve a record in Microsoft Flow, we create an Action by clicking the + Button and selecting “Add an Action”. This opens up a dialog that allows us to search by service or action. To retrieve a record from Dynamics 365 we type in “Get Record” and select “Dynamics 365 – Get Record“. After the Action is created, we need to provide the Organization Name, the Entity, and the Item Identifier. In Dynamics 365, the Item Identifier will be the GUID of the record we are looking for and we can utilize the Trigger to grab to values of the created record and input them into our Get Record Action.

Retrieving the User

In the newly created Get Record Action, we will provide the Organization Name, and the Entity Name (Users). When we click into the Item Identifier field for the Get Record Action, we will see a Dynamic Content menu appear. This pane will display available values from the previous steps. (Just know that it displays a small list to start and you have to click “See More” to view/search all the available fields.) From this pane we will select Created By which will return the GUID value of the Lookup in Dynamics 365.

Retrieving the Account (Parallel Branch)

To retrieve the Account Record, we will add a “Parallel Branch” above the Get User Record Action. This will allow our Flow to retrieve these values simultaneously, as opposed to doing one retrieve and then another.

Once our parallel branch has been created we can follow the previous steps to retrieve the Account record, but with the appropriate values.

Adding Conditions

Now that we have all the information we are looking for, we can begin to add some logic to our Flow. Our scenario is to alert different Microsoft Teams Channel’s depending on the Customer (Account) the Case has been created for, and to achieve this, we will add a “Switch Case” as our next step in the Flow instead of an Action.

This will present us with three blank steps:

  1. The first is the On value, which will be the basis of our Switch Case.
  2. The second will be an empty Case statement.
  3. The last will be our default Case statement.

Switch

The Switch Step will contain the the On value that will hold the value that each Case will compare against to decide if it should perform the action. The On value will be the Account Number which we can select from the Get Records Account Action from inside the Dynamic Content pane.

Cases

Inside the first Case Step we will fill in the Equals value with a string value for the Account Number. In our example we have “ACCT001”, but this will depend on the Account Number you wish to specify an Alert in Teams for.

We can add more Case Steps by selecting the + symbol between the Default Case and First Case. In our example, we have two Case Steps and one Default Case Step.

Alerting the Team

Inside of each Case Step we will add an Action to Alert our first Team Channel,  by searching “Alert Team” and then select “Microsoft Teams – Alert the team“. After you have added the Action Step, the Message parameter can utilize the Dynamic Content from all the previously retrieved records.

Running Your Flow

Now that you have created your Flow, you will want to see it in action! You will want to make sure your Flow is turned On. (You can see this from the My Flows area) Then you will need to navigate to the Dynamics 365 instance that you have the Trigger hooked up to, create a Case, and watch the magic!



Trigger

​Flow 2
Flow 1
Parallel Branch
Dynamic Content Pane
Action
Flow Total

For more information I highly suggest digging into Microsoft’s Getting Started Guide, as it has pretty good documentation on a lot of the different services.


You might also like