Under the Power Platform name, Power Apps and Power Automate will unite. As a result, flows can now be added as a component into a CDS solution. The new addition saves on deployment time. I have been helping a new to Power Automate flow colleague and we found a few caveats.
Who moves my flow?
You can manually run a flow in CDS, but does it always work?
Let’s create a flow in CDS solution, which triggers ‘When a record is selected’ using the Common Data Service connector. Nothing out of the ordinary here.
Note how there is no equivalent trigger in Common Data Service (current environment) connector. I will talk about CDS vs CDS (current environment) later.
When I go to a model-driven app, select an account record and click Flow in the command bar. There are no flows to run.
Now, go back to the flow and click ‘Save as‘. This will make a copy of the flow in Power Automate, outside of CDS solution.
Ensure you turn on this newly copied flow. Now, go back to CDS, select an account record and check flow. Now you can see the flow from Power Automate, outside of a CDS solution.
Who can run the flow?
Currently, a flow can only be seen in the model-driven app, if you are the owner of the flow. You won’t see the flow even if you have the privilege to run it in CDS.
This is a concern to flow makers.
- What if everyone in the organisation needs to run a specific flow?
- Should everyone own the flow?
- What if they edit the flow?
I am hoping this is a bug that Microsoft will address in the near future.
Choice of connector: CDS vs CDS (current environment)
Ideally, CDS (current environment) should be a superset of CDS connector. However, this is not always true.
CDS connector supports the trigger ‘When a record is selected’.
But this trigger is missing from CDS (current environment) connector. On the other hand, CDS (current environment) connector offer a richer set of combined triggers.
Use CDS connector if you need to run flows manually on a selected record.
Use CDS (current environment) connector if the flow is automatically triggered.
Here, CDS (current environment) connector bosses and punches hard CDS connector, if we put two connectors inside the ring.
You can do a lot more with CDS (current environment) connector such as the followings but not limited to
- creating a record with complex data type (such as party lists are essential to activities) in CDS
- performing various CDS actions such as SendEmail, SendEmailFromTemplate using bound and unbound actions
- using Relate and Unrelate records action to associate/disassociate 1:N or M:N relationships
- executing changeset requests (Scott Durow has a blog post about it)
- predicting with AI builder
Of course, you can achieve all the above using HTTP action without using CDS (current environment) connector, but that means you need to register an app in Azure, grant appropriate permissions in Azure and CDS, which is not a simple task for a citizen developer. It also complicates the deployment process.
CDS (current environment) is a no-brainer. It is currently and officially available to flows created in CDS solution.
If you are looking for how to access CDS (current connector) outside of the solution, then you have to the right place, just carry on reading.
Using CDS (current connector) outside of the solution?
If you need to use CDS (current connector) and need to run the flow manually, what can we do?
First, create a flow in CDS solution. Include at least one action step from CDS (current connector); Make a copy to Power Automate (using ‘Save As’ button); Then go to Power Automate and edit the copied flow.
Boom 💥 you can now access CDS (current environment) connector outside of your solution.
Use Service Principal
When we build a flow, we mostly use our user account to create a connection to CDS. However, best practice dictates that we should not be using user account in UAT or Production environment.
If our own user account is used for connections, any CRUD actions will use our account and I am certain you don’t want to see your name all over the audit history in Production environment.
Both connectors support connecting to CDS using a Service Principal. You need to register an app in Azure, grant it the appropriate permissions and create an application in CDS with the proper security roles. Finally, use it to perform CRUD actions in CDS.
Some organisations may follow a long process to create service principals. As a precaution raise the question and start the process of getting one as early as you can.
Neither CDS nor CDS (current environment) connectors are perfect. Use them together and get the best out of the two worlds.
Keep your Power Up until next time.