Thu, 07/30/2020 - 11:10 By Amaury Veron
2 comments
Business Process

Introduction


Presentation

Power Automate is a low-code tool that allows creating automated workflows between application and services to synchronise files, get notifications, collect data and more. These processes can be triggered by events or manually.

Below is an overview of the interface of a Power Automate Flow:
 

Power Automate Flow overview

As can be seen, Power Automate allows to define processes using a graphical interface. The goal is to make it available to a large audience.
Power Automate has hundreds of different data sources and services, which are called “Connectors”. Below is a very short overview of some main connectors:

  • Office 365 Outlook
  • OneDrive for Business
  • SharePoint
  • Twitter
  • Notifications
  • Gmail
  • YouTube
  • Dynamics 365
  • Common Data Service
  • Azure Blob Storage
  • Salesforce
  • SQL Server
  • Azure Key Vault

Note: The Power Automate was formerly called Microsoft Flow. This old name is still used in many documentations.

Context of Dynamics 365

Workflows in Dynamics 365 are a main component to implement some custom logic in the CRM. They are configured with a graphical interface.
Today, when creating a background Workflow in Dynamics 365 the following message is displayed:
 

Dynamics Workflow creation modal box

 

Microsoft advises to use Power Automate (The old name “Microsoft Flow” is still used here) instead of Dynamics 365 background workflows. Background means that the Workflows are asynchronous.
Yet, most people still use Dynamics 365 Workflows because it takes time to learn a new tool. Then, this Chronicle will present Power Automate. It will provide an overview of the tool and will compare it with D365 Workflows. The goal is to let people know when they should use Power Automate.
First, we will see how to use Power Automate with Dynamics 365.
Then, we will review the licensing model of Power Automate.
Finally, we will focus on the Pros and Cons of Power Automate.



Use Power Automate for Dynamics 365


Create a Power Automate Flow


To use Power Automate with Dynamics 365, go to the admin portal of Power Apps: make.powerapps.com.
Then, go in Solutions -> New Solution -> New Flow

C:\Users\ave\Downloads\Power Apps create new Power Automate Flow

 

Then, select the Flow and click Edit -> redirects to page of Power Automate:

Power Automate Flow creation

Connectors, Triggers and Actions


As said previously, Power Automate has many connectors. Each connector contains triggers and actions. A trigger is an event that will launch the execution the Power Automate Flow. An action will perform…well, some action.
Power Automate has 3 connectors that can connect to Dynamics 365:

  • Dynamics 365
  • Common Data Service
  • Common Data Service (current environment)

The last one, “Common Data Service (current environment)”, should always be used. It provides more functionalities that the other connectors (see section "Power Automate in Dynamics 365 Solutions" below).
 

Triggers

The connector “Common Data Service (current environment)” has one trigger available:
    “When a record is created, updated or deleted”

Power Automate Trigger

The trigger allows to choose the condition to run the Flow (on Create, on Update, etc.). It applies to a precise Entity. As in D365 Workflows, the Scope can be chosen (Organization, User...). It can be filtered to make the trigger active only on some attributes. It can also be postponed.

Actions


Here are the actions available in this connector:

  • Create a new record
  • Delete a record
  • Get a record
  • Get a file or image content
  • List records
  • Perform a bound action: This runs an action in Dynamics 365 bounded to an Entity
  • Perform an unbound action: This runs an action in Dynamics 365 which is not bounded to an Entity (called as static operations)
  • Predict: Use AI Builder models. With the predict action you can use your custom AI Builder Models of Form Processing, Object Detection, Text Classification or use the prebuilt Business Card Reader, Key phrase extraction, Language detection, Text recognition – OCR and Sentiment Analysis.
  • Relate records: The relate function links two records that have a one-to-many or many-to-many relationship in the Common Data Service.
  • Unrelate records: The unrelate function removes the link between two records that have a one-to-many or many-to-many relationship in the Common Data Service.
  • Update a record
  • Upload a file or image content

Note: Performing an action from Power Automate is a recent feature. It improves a lot the functionalities of Power Automate for Dynamics 365. Before that, it was necessary to create a HTTP request in Power Automate to call the Dynamics 365 action. 
This shows that Microsoft is currently investing a lot on Power Automate.
 

Power Automate in Dynamics 365 Solutions

As said previously, a Power Automate Flow can be created in a Solution from the PowerApps customisations portal.
The Power Automate Flow can be transferred from one environment to another one very easily: just by transferring the solution in which it is contained.
When using the connector “Common Data Service (current environment)”, the Power Automate Flow automatically changes the connection to the environment in which the solution was imported. So, if the Flow is created in environment A and is imported to environment B, the connector will automatically switch from environment A to environment B.

But this is not the case when using the connectors “Dynamics 365” or “Common Data Service” ! With these connectors, if the Flow is created in environment A and is imported to environment B, the connector will still point to environment A. It will have to be manually switched to environment B. So, this is a great reason for using only the connector “Common Data Service (current environment)” when integrating Power Automate in Dynamics 365.
Note: The Power Automate Flows are visible (but not editable) in solutions in the Classic Interface:

Power Automate Flow in Dynamics 365 Solution

 

Why using Power Automate from PowerApps portal

So far it was indicated to create the Power Automate from the PowerApps portal (at make.powerapps.com). Power Automate Flows can also be created directly from the Power Automate Portal at https://emea.flow.microsoft.com/en-us/. However, the connector “Common Data Service (current environment)” is not available if the Flow is created from here.
Not having this connector prevents access to many functionalities of Dynamics 365 such as performing actions and easily transfer Power Automate Flows across environments.
So, it is important to create the Power Automate Flow from the Power Apps Portal.

Licensing

This Part provides an overview of the Licensing model associated to Power Automate.
As the licensing model evolves frequently it is important to check it regularly.

Power Automate licence

Power Automate has two different standalone licences:

  • Licence per User: Allows individual users to create unlimited flows based on their unique needs. Costs 15 CHF/user/month. With access to automate legacy applications through robotic process automation (RPA) and AI, the licence costs 40CHF/user/month.
  • Licence per Flow: Implement Flows with reserved capacity that serve unlimited users across an organization. Starts at approximately 500 CHF for five flows per month. Additional Flows may be purchased for 98 CHF per Flow/month.

These 2 licenses are limited to 5,000 daily API requests.
Note: Purchasing and assigning licenses requires access to the Microsoft 365 admin center with either the global administrator or billing administrator roles. 

Power Automate capabilities are also included within Power Apps, Office 365 and Dynamics 365 licenses. We will focus now on the Power Automate capabilities provided by a Dynamics 365 license.
 

Power Automate with Dynamics 365 licence

Dynamics 365 licenses include Power Automate use rights for the purpose of customising and extending Dynamics 365 application(s).
Power Automate use within Dynamics 365 is limited to the context of the embedding Dynamics 365 application. For both triggers and actions, flows included within the Dynamics 365 application can connect to:

  • Any data source within the use rights of the Dynamics 365 application
  • Directly with the Dynamics 365 application (via built in trigger/action)

If the embedded flow is not within the context of the Dynamics 365 application, then standalone Power Automate licenses will need to be purchased.
 

Power Automate use rights with D365 licenses

 

The API requests are limited to a certain daily amount. This amount depends on the license purchased. Here are the API limits for licences:

Power Automate with D365 API requests limits

Power Automate capacity add-on allows customers to purchase additional requests. Eventually, these may be assigned to any user who has a Power Automate license as well as a Dynamics 365 license.
Each capacity add-on provides an additional 10,000 requests/24 hours which can be assigned to any user. Multiple capacity add-ons can also be assigned to the same user.

Link to licensing guide: https://go.microsoft.com/fwlink/p/?linkid=2085130

API limits: https://docs.microsoft.com/en-us/power-platform/admin/api-request-limits-allocations

 

Comparison with Logic Apps

People working on Power Automate may also have heard of Azure Logic Apps. The two tools are very similar, and this can be disturbing for the user. Azure Logic Apps is actually the engine behind Power Automate. Both Power Automate and Logic Apps provide the ability to create automation processes using a similar interface and an almost identical set of connectors.
Here are some differences:

  • Logic Apps doesn’t have the connector “Common Data Service (current environment)”. So, Power Automate is much better to use with Dynamics 365.
  • While both tools have a low code interface, Logic Apps is slightly more technical than Power Automate. In particular, from Logic Apps it is possible to access the code generated behind the graphical interface. This can give more flexibility when creating a process.
  • One last main difference is on the billing model. In Power Automate, some features and the number of automations that run during a month are limited to the license assigned to the user who created them. Logic Apps is part of an Azure Subscription and billed on a consumption model. Power Automate has a mix of standard and premium connectors.  Premium connector availability is dependent on the licensing level. Logic Apps have Standard and Enterprise connectors.  Both Standard and Enterprise are available in Logic Apps but billed at a different rate per execution.

 

Power Automate Pros and Cons


Use cases: Power Automate vs Dynamics 365 WFs


So, Power Automate is a powerful automation tool that provides many features to interact with Dynamics 365. So, it has functionalities similar to the Workflows of Dynamics 365. But there are still important differences between the two tools.
This part will present cases for which a tool might be better suited than the other.


Consider using Dynamics 365 Workflow in these cases:

  • The entire process happens within Dynamics 365 Customer Engagement. The performance and the runs of the Workflows can easily be managed in the settings of the CRM.
  • For real time or near real time jobs: Workflow can be synchronous (real-time). Power Automate Flows are not synchronous, so they are not as quick as Workflows.
  • For email notifications: it is easy to send emails to some precise persons under certain conditions.
  • To run on-demand processes on some records: Dynamics 365 Workflow is the easiest solution. It only requires selecting “on-demand” in the customizations to be run manually on any record.

Consider using Power Automate Flows in these cases:

  • For SMS notifications: Using the Twilio connector, Power Automate can easily send and receive SMS text notifications for Dynamics 365 events. The standard pricing for Twilio is $.0075 per message sent, making Power Automate the easiest and least expensive way to get Dynamics 365 SMS based notifications.
  • Email notifications sent from non-users. Power Automate can be used to have email notifications coming from a mailbox that isn’t associated with a Dynamics 365 user. It can instead use an account of Gmail or Hotmail for instance. This could save a Dynamics 365 license for the account that sends email notifications.
  • For users of Dynamics 365. Power Automate is more user friendly and more visual than the Dynamics 365 Workflows.
  • Deleting records: There is no standard delete option with Dynamics 365 Workflow. Power Automate includes several options not available from standard Dynamics 365 workflow, including the ability to get a list of records and execute an operation for each record in the list, and the option to delete records. 
  • Scheduled jobs: Dynamics 365 includes some options in Workflow to delay a job for a specific time period (using a timeout or wait condition), but it consumes a lot of resources. Power Automate allows to schedule executions of Flows. In term of performance, this is a great advantage for Power Automate. The "wait" conditions of D365 Workflows can lead to thousands of Workflows running in parallel, overloading the Dynamics 365 Asynchronous Processing Service.

    
Additional Note: 
Power Automate is more verbose than Dynamics 365 Workflows, for instance when writing conditions. Also, when option sets are used, the IDs of the options have to be retrieved in the CRM to use them in Power Automate. Whereas in Dynamics 365 Workflows the options are directly available. So Dynamics 365 Workflows can be easier to write in some cases.

Power Automate vs Traditional coding

Power Automate has many tools similar to code-based programming languages, such as loops, conditions, variables.
However, Flows of Power Automate provide much less functionalities than a code-based programming language. For instance, they are less efficient to handle exceptions and to debug processes.
Several processes made at ELCA with Power Automate have become very complex and very hard to maintain. In these cases, coding would have been a better solution.
So, Power Automate should be used with simple processes that do not contain too complex logic. It should be used as an orchestrator: to handle connection to data sources/services and to launch code-based sub processes (if the logic is complex).
 

Conclusion

  • Power Automate is a complete automation tool. It provides many new features compared to Dynamics 365 background workflows.
  • The Dynamics 365 license includes rights to use Power Automate with D365. However, there are some daily API limits to consider. In case of need, add-ons can be purchased to extend these limits.
  • Dynamics 365 background workflows still have advantages compared to Power Automate. For instance, they are internal to the CRM so they are better integrated.
  • Power Automate has got a more beautiful and user-friendly interface, making it available to more people. But it is often more verbose.
  • Ideally, Power Automate and Dynamics 365 background workflows should both be known as they each have their advantages. Microsoft invests a lot in Power Automate so it should get more and more powerful. Then, it is a good idea to start discovering Power Automate! 
     

Comments

Good article Amaury, thanks. Question...should I consider exploring Power Automate for tasks previously done as a JavaScript web resource. For example, if i wanted to validate an entry into a text field BEFORE the record was saved, thus preventing the record from being saved if it failed?

Wed, 04/07/2021 - 09:17
Gerald Dunn (not verified)

Thank you Gerald for your comment !

For Dataverse (new name of Common Data Service), a Power Automate Flow can only be triggered after a record is saved. So, you would not be able to use it to validate an entry before the record is saved.

More generally, about exploring Power Automate for tasks previously done as JavaScript:

Yes I think that this can be a good idea, when the process you want to implement can occur after saving of a record.

In term of performance, it is important to keep in mind that Power Automate runs Server-Side and JavaScript runs Client-Side. Sometimes, Power Automate Flows can take a few seconds before being triggered. Whereas JavaScript code is instantly triggered.

 

Another low-code tool that you might consider using is the Business Rule, that can run on the Client Side like JavaScript: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-business-rules-recommendations-apply-logic-form (we don’t have an article yet about it in our blog but it might come in the future)

With Business Rules you can validate data and show error messages. And also do actions such as Clear a field, Set a field as Required, Show or Display a field, … :)

I hope this will help you!

Fri, 04/09/2021 - 18:17

In reply to by Gerald Dunn (not verified)

Add new comment

Image CAPTCHA
Enter the characters shown in the image.