cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LogicSmith
Helper IV
Helper IV

Common sub-flows usable by multiple flows?

Is it possible to have a set of common sub-flows that every flow would have access to? I'm thinking of a sub-flow that logs into a web site, which might be needed by many flows. In the free version of Power Automate, it appears that the sub-flows are limited to one flow. If true, this would be a major problem to using this tool extensively.

9 REPLIES 9
MichaelAnnis
Super User
Super User

What about "Run Desktop Flow"?

 

So, your subflow could be by itself in a Run Desktop Flow which can take input variables and produce output variables and you could direct your new flow to run the desktop flow containing 1 or multiple subflows.

 

MichaelAnnis_0-1652460241164.png

 

LogicSmith
Helper IV
Helper IV

That should take care of it, thanks! I just started using PA a few weeks ago, and obviously missed that particular action. At least I'm early enough in the process I can make major design mods if I need to. 

LogicSmith
Helper IV
Helper IV

OK, this works great. Now, followup question. What happens when I accumulate hundreds of desktop subflows? It's similar to the UI Elements - what happens when I have hundreds of them? I am accumulating suggestions and certainly beefing up how it handles flow and UI element management is high on the list.

Yeah, this is difficult.  There are no groups; you just have the one text string.  So, I recommend normalizing your text strings to be systematic, for whatever works for you.  Example would be flow titles.  Maybe I have flows for logging into each of my bank accounts and can use a Who_What_Where system for creating my flow titles:

 

Mike_Login_Chase
Mike_Login_BofA
etc.

 

Good luck!

LogicSmith
Helper IV
Helper IV

Yes, got past that point. Now only issue (that I've hit) is the inability to pass anything to a flow besides a string. Would love to have a flow that logs into browser and app, but cannot return the browser instance. Found a way to workaround by having every flow look for the browser, but that can get complicated if you want one test to run on more than one browser.

 

Are you saying you can't pass a Browser Instance back from the child flow?

LogicSmith
Helper IV
Helper IV

I have not yet found a way. The only output variable type is a string. I may be able to convert a browser object instance into a JSON string, but don't know that I can convert that string back into a browser instance. The workaround is to open the browser in the flow that does the login, then in any other subsequent flow, set the browser open to attach to the browser instead (it helps that all the URLs start the same). Takes it a few seconds to find and attach to the browser, but that's not a major problem right now.

Dang, that sucks.  I hadn't ever used it before, but just tried to troubleshoot this.  At least, you can set an outputvariable to the URL which can be retrieved by the flow and set as an output variable.  And then call the URL during "Attach to Chrome", so that you don't have to set those up individually:

 

So, my login flow (the child flow) used a "Get details of web page" action just before it's conclusion and passes the %OutputURL% to the parent flow which then used %OutputURL% to attach to chrome and get the security question.

MichaelAnnis_1-1652736551190.png

 

MichaelAnnis_0-1652736529663.png

Although this isn't ideal.  It gives you a blanket way to set all output URLs to the same variable and call those OutputURLs the same way.  So flow Parent Flow A doesn't need the specific Child Flow A URL, but rather the blanket %OutputURL% every single time.

LogicSmith
Helper IV
Helper IV

I like your solution, but in my case the base URL is all I need to find the browser window, doesn't seem to matter if the actual full URL is different at the end. I'm still learning, so it's fun. Today's task is to modify my login flow to pass in url, username, password, and browser. So I get to learn how to do a case statement on the browser.  Then adapt the case statement into every flow so everything hooks together. Piece of cake. Large piece, but may be able to finish it today.

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Top Solution Authors
Top Kudoed Authors
Users online (2,675)