A tricky Flow

By | November 7, 2019

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:

image

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:

image

image

Let’s see if it works? I’ve created a lead, and here is my email notification:

image

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:

image

And I have my email with the proper name now:

image

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:

image

Everything is perfect, but now we need to fix the connections for the flow:

  • image
  • Once the connections have been fixed, apparently we need to save the Flow.
  • What happens to the solution layers when we click “save”, though?

 

image

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:

image

That solution is, then, exported with a higher version, and I’m about to bring it over to production:

image

I should see that attribute added in production now, right?

image

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:

image

All connections in the Flow will be broken again, but that additional attribute will finally show up:

image

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.

 

3 thoughts on “A tricky Flow

  1. Kim

    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

    Reply
    1. Alex Shlega Post author

      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.

      Reply
  2. Julien C

    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.

    Reply

Leave a Reply to Julien C Cancel reply

Your email address will not be published. Required fields are marked *