On-Demand Microsoft Flow for Dynamics 365 and PowerApps

Aaron Back, MCSE

Why this post?

This post is a segment of something I covered during my User Group Summit 2019 session. This session was called "Triple Threat - Microsoft Flow, Dynamics 365, and You". During this session I covered various ways you can utilize Microsoft Flow with Dynamics 365.

If you attended the User Group Summit 2019 in Orlando, FL, and you purchased the video recordings add-on package, you can access the recording library now.

Now, on with the blog!

On-Demand Microsoft Flow - What is it?

If you have been using Dynamics 365 (CRM) for sometime, you will know about on-demand workflows. They are a way to allow users to run automation only when needed. They will not run through some sort of automated trigger.

So, like the on-demand workflows of old, we are now in the age of Microsoft Flow. We can now create on-demand Microsoft Flows to provide on-demand automation.

First Things First - Dynamics 365 Settings

Prior to utilizing Microsoft Flows within Dynamics 365, you will need to enable this setting. New versions of Dynamics 365 since the October 2019 update will have Microsoft Flows already enabled.

To enable the setting, you will need to navigate to Settings>System Settings>Customizations. Next, click on "Yes" under "Enable Microsoft Flow".

Microsoft Flow setting in Dynamics 365

Second Things Second(?) - PowerApps Settings

The Power Platform Admin Center contains the Microsoft Flow setting as well. To enable the setting, you will need to navigate to https://admin.powerplatform.com>Click your Environment name>Settings>Behavior. Next, toggle the "Show Microsoft Flow on forms and in the site map" setting to "On".

Microsoft Flow setting in Power Platform admin center

Microsoft Flow Menu Button

Once the settings are enabled, the Microsoft Flow menu button will be visible in various places. First, you will see the menu button above a view in Dynamics 365.

Microsoft Flow menu button above a View

Second, you will see the menu button at the top of a record form in Dynamics 365.

Microsoft Flow menu button on a record form

Third, you will see the Microsoft Flow option in the classic Dynamics 365 Settings Menu.

Microsoft Flow option in the Dynamics 365 Settings

Fourth, you will see the menu button at the top of a view in a model-driven PowerApp.

Microsoft Flow menu button above a View in PowerApps

Fifth, you will see the menu button at the top of a record in a model-driven PowerApp.

Microsoft Flow menu button on a record form in PowerApps

Start Creating the On-Demand Microsoft Flow

Now, we are at the fun part of creating a Microsoft Flow! You can start your Microsoft Flow creation in a couple of ways. You can navigate to https://flow.microsoft.com, or you can navigate to https://make.powerapps.com and select "Flows" on the right-hand side.

The example today will be a simple one, and it's only meant to demonstrate how to set up the on-demand Microsoft Flow.

On the Microsoft Flow site, click on "New" and select "Instant - from blank".

Microsoft Flow create new Instant Flow

Next comes a small tip you need to know. When the "Build an instant flow" window appears, the "When a record is selected" option is NOT visible.

Build an instant flow - When a record is selected is missing

Now, click on the "Skip" button at the bottom, and this will load the "Search connectors and triggers" screen.

Microsoft Flow - Search connectors and triggers screen

Now comes the tip. Type "Common Data Service" in the search field, and you will now see the "When a record is selected" option.

Build an instant flow - When a record is selected is now visible

Building the On-Demand Microsoft Flow

After the "When a record is selected" option is available, select it. Next, give your Microsoft Flow a name, and then select an Environment and an Entity. Also, be sure to rename the first step to something more meaningful.

Build an instant flow - Creating a Flow - First Steps

The next step will update the Account Name on the Account record to uppercase.

Build an instant flow - Creating a Flow - Next Step

  1. Rename the step
    • Always put a meaningful name on your Flow steps.
  2. Select the Environment
    • Use the "Current" option from the list. This will make exporting and importing Flows from environment to environment easier.
  3. Select the Entity
    • Choose the correct entity to use in the action.
  4. Input the "Record Identifier"
    • Select the "Account" option using the fields available from the prior step.
  5. Update the field
    • This is where the Account Name will get updated to uppercase. The formula to use here is toUpper(triggerBody()?['entity']?['name']).

Microsoft Flow Tips

Before we continue, I wanted to provide some quick tips to help you build the expression used above. The expression portion of "triggerBody()?['entity']?['name']" is the code for the Account Name field. Now, let's look into how you can obtain this.

First, let's get the code for the Account Name field. Select the "Account Name" field from the list so that it appears in the field. Then click on the ellipsis button and choose "Peek code".

Build an instant flow - Expression tips

Second, look in the code list and you will see the "name" code in the middle. Highlight the code to copy it, but DO NOT copy the "@" symbol and the "" quotes.

Build an instant flow - Peek code info

Third, you need to know how to input an Expression. Remove the "Account Name" field you just added, and click on the field in the action step. Next, choose the Expression tab on the pop-out box.

Build an instant flow - Start the input of an Expression

Fourth, type in the expression "toupper()" (without quotes) in the Expression field. Now, paste the code you copied from the second step above. The expression should look like the below screen shot.

Build an instant flow - Expression code

Lastly, your Flow should look like this. Be sure to save the Flow now.

Build an instant flow - Finished Flow

Running the On-Demand Microsoft Flow in Dynamics 365

The last step is to run the Flow in Dynamics 365, and in PowerApps, to see if it will work. After you have saved your Microsoft Flow, you should now see it within the Microsoft Flow menu button.

Microsoft Flow menu button

Next, click on the Flow and a "Run Flow" window will pop up. Click on the "Run Flow" button.

Microsoft Flow menu button - Run Flow

Once the Flow runs, you should refresh the list and you will see the "Consolidated Messenger" account name is now uppercase.

Microsoft Flow - Account Name is now uppercase

Running the On-Demand Microsoft Flow in PowerApps

Lastly, let's look at this within a model-driven PowerApp.

Microsoft Flow menu button in model-driven PowerApp

After the Flow has been run, you will now see the Account Name is uppercase.

Microsoft Flow - Account Name is now uppercase in model-driven PowerApp

In Closing

You will need to keep in mind that the Flows need to be set up for each Environment. I had set up 2 Flows with one for the Dynamics 365 environment and one for the PowerApps environment.

Also, I would recommend you test your Flows against a Sandbox environment to ensure your Production environment is not harmed. You can export and then import Flows from one environment to another. Or, you can include Flows within a Solution ONLY within the PowerApps Maker site. You can't do this in the Classic interface.

Hopefully, this blog helps you understand how to get on-demand Flows working for you. Until next time.


Aaron Back is a Microsoft MVP with many years' experience with Microsoft Dynamics 365 (CRM), PowerApps, Microsoft Flow, and Power BI. He is actively involved with the Microsoft Dynamics 365 UG (D365UG) (User Group) Community. His involvement includes: Serving as Chapter Leader for his local D365UG Chapter, serving on the D365UG Board of Advisors, and speaking at the annual D365UG Summit conference.


ACE Microtechnology, Inc. is a professional services firm committed to delivering Dynamics 365 (CRM) business solutions to small and medium sized organizations. Our focus is on delivering products and services that improve our clients’ business operations. ACE has developed specialties in serving the lite manufacturing, distribution and the hospitality industry.

Rather than just building technology or implementing software, we deliver real business value through industry knowledge and understanding each client’s business. We make it our business to know your business.

For more information or assistance with Dynamics 365 (CRM) contact ACE!

4 thoughts on “On-Demand Microsoft Flow for Dynamics 365 and PowerApps”

  1. Aaron Hi. I built my flow in a solution. With 'when a record is selected' i can only chose the default environment - the others don't come up. I then don't see the flow in the modeldriven app.It's fine if I do it as 'My Flow' is create it from teh model driven app. Any ideas where I am gong wrong?

    1. Hello Danny! Thanks for the question. I believe there is a current issue with the "When a record is selected" trigger for flows within a solution. If you create the flow outside a solution, you should be able to see the flow in the "Flows" menu/button in the model-driven app.

      Additionally, I have seen issues where you need to clear your browser cache, log out, and then log back in. Then the flow(s) will appear in the "Flows" menu/button.

  2. Nice walk-through.
    It seems like at the moment, Flows (Power Automates?) that are created in a solution will not show up in Dynamics for on-demand running.
    Don't suppose you can confirm or deny?

    Cheers.

    1. Yes, currently this seems to be the case for flows created in a solution. I have run tests on my end and the flow "buttons" do not appear within Dynamics for on-demand use. Hopefully, this will be addressed with the Wave 1 2020 release in April.

Comments are closed.