Why this post?
This post is a segment of something I covered during my
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
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".
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
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.
Second, you will see the menu button at the top of a record form in Dynamics 365.
Third, you will see the Microsoft Flow option in the classic Dynamics 365 Settings Menu.
Fourth, you will see the menu button at the top of a view in a model-driven PowerApp.
Fifth, you will see the menu button at the top of a record in a model-driven PowerApp.
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
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".
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.
Now, click on the "Skip" button at the bottom, and this will load the "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.
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.
The next step will update the Account Name on the Account record to uppercase.
- Rename the step
- Always put a meaningful name on your Flow steps.
- Select the Environment
- Use the "Current" option from the list. This will make exporting and importing Flows from environment to environment easier.
- Select the Entity
- Choose the correct entity to use in the action.
- Input the "Record Identifier"
- Select the "Account" option using the fields available from the prior step.
- 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".
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.
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.
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.
Lastly, your Flow should look like this. Be sure to save the Flow now.
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.
Next, click on the Flow and a "Run Flow" window will pop up. Click on the "Run Flow" button.
Once the Flow runs, you should refresh the list and you will see the "Consolidated Messenger" account name is now uppercase.
Running the On-Demand Microsoft Flow in PowerApps
Lastly, let's look at this within a model-driven PowerApp.
After the Flow has been run, you will now see the Account Name is uppercase.
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.
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
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?
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.
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.
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.