I got a tricky Power Automate Flow the other day – it was boldly refusing to meet my expectations in what it was supposed to do. In retrospect, as much as I would want to say that it was all happening since Power Automate was in a bad mood, there seem to be a couple of things we should keep in mind when creating the Flows, and, somewhat specifically, when using Common Data Service(current environment) connector:
That connectors supports FetchXml queries in the List Records action, which makes it very convenient in the situations where you need to query data based on some conditions.
Here is what may happen, though.
Let’s imagine some simple scenario for the Flow:
- The Flow will start on create of the lead record
- When a lead is created, the Flow would use “List records” action to select a contact with the specific last name
- Finally, the flow would send an email to that contact
And there will be two environments, so the idea is that we’ll use a managed solution to move this flow from development to production:
Let’s see if it works? I’ve created a lead, and here is my email notification:
But wait, wasn’t it supposed to greet me by name, not just say “Hello”?
Problem is, even though I can use all those attributes in the flow, they have to be added to the FetchXml in order to query them through the List Records action. Since I did not have firstname included in the Fetch, it came up empty.
The fix is simple:
And I have my email with the proper name now:
Now let’s bring this flow through a managed solution to another environment.
- Export as managed
- Import into the prod environment
Before I continue, let’s look at the solution layers for that flow in production:
Everything is perfect, but now we need to fix the connections for the flow:
- Once the connections have been fixed, apparently we need to save the Flow.
- What happens to the solution layers when we click “save”, though?
That is, actually, unfortunate. Let’s say I need to update the Flow now.
In the development environment, I can add an extra attribute to the Fetch:
That solution is, then, exported with a higher version, and I’m about to bring it over to production:
I should see that attribute added in production now, right?
You can see it’s not there.
I would guess this problem is related to the solution layering – when updating connections in production, I had to save the flow there, and that created a change in the unmanaged layer. Importing updated managed solution made changes to the managed layer, but, since it was an existing solution/flow, those changes went just under the unmanaged layer, so they did not show up on the “surface”.
If I go to the solution layers for my flow in product and remove active customizations:
All connections in the Flow will be broken again, but that additional attribute will finally show up:
This is when I can fix the connections, and, finally, get the Flow up and running as expected.
Of course another option might be to remove managed solution completely and to re-import updated version. Since I normally have Flows/Workflows in a separate solution, that would probably work just fine, even if I had to request a downtime window.
Hi
Once you start using other connectors, the approach of not fixing the connections is not possible, right?
Also, removing and reimporting will not be enough as for example the connection to O365 mailbox (or any other connector) will not be ok?
Kind regards
Kim
Awesome question. Working mostly on the CDS side, I tend to miss these things:) You are probably right, though, once you start mixing in other connectors, this will go wrong. Wondering to what extent – will try to test it out.
Hello,
Thanks for this post !
Did you find a better workaround to adapt the flows when a new managed solutions are imported ?
I’ve the same limitation and the only ways to see my changes are
– to use the method explained in your post
Or
– to use the “classic” editor to import my solution with the option “overwrite” checked (but in this case the connections reference are ignored during the import 🙁 )
So any idea or help is more than welcome ?
Kr,
Julien C.