Expand/Collapse all Actions for Microsoft Power Automate Flow

Paul Nieuwelaar, 27 May 2020

One thing I’ve been secretly wanting added to Flow (Power Automate) for a while now is the ability to expand all actions/steps within the editor. Recently I had to go through and update a bunch of references from one value to another across a few different Flows, and since the “collapsed” actions aren’t actually rendered into the DOM until they’re expanded, it’s impossible to just quickly search for the thing you’re looking for. Instead, you have to manually expand each conditional branch, loop, and each individual action just to see all the contents.

This feature has been requested before, so I decided it can’t be that hard to just make a Bookmarklet that does it.

Here’s the complete code to add to a new Bookmarklet. I called mine “Flow Expand/Collapse”, and this can just be added to your bookmarks bar for your browser.

javascript:var expand=expand!==undefined?expand:true;var maxTries=10;var expandCollapse=function(){console.log("----Expand groups: "+expand);var groups=document.getElementsByClassName("msla-card-title-group");var hasClicked=false;for(var i=0;i<groups.length;i++){var actionHeader=groups[i];if(actionHeader.getAttribute("aria-expanded")!==""+expand){console.log(actionHeader.getAttribute("aria-label")); actionHeader.click();hasClicked=true;}}if(hasClicked&&--maxTries>0){setTimeout(expandCollapse,1000);}else{console.log("----Done");expand=!expand;}};expandCollapse();


Now that we have this bookmarklet created, if we take this innocent looking Flow with just 3 simple steps:


And we click our new bookmarklet, we can see there’s a bunch of nested steps within conditions and loops that would take us ages to expand everything to find what we’re looking for. We can now also just Ctrl + F to find whatever we need instantly.

Because of the way the elements are rendered asynchronously, there’s a 1 second timeout between expanding each level of the hierarchy. If you notice stuff isn’t expanding correctly, you may need to increase that 1000 timeout to 2000 etc.

We can also click the bookmarklet again to collapse everything back down.