cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChadVKealey
Memorable Member
Memorable Member

Populating "Flow Definition" field in "Create Flow" action

In the (fairly) new "Power Automate Management" connector, there are a bunch of actions for managing flows. So far, I've used them to build a set of flows to inventory my flows as well as an "update flow" flow to enable/disable or delete a flow. It's very meta. Anyway, I noticed one of the templates was named "Create a file in SharePoint to save modified Flows in JSON format daily" and that got me thinking that it would be great to export the definition of the flow to a json file before deleting it (in the event that I need to rebuild the flow later). There is a "Create Flow" action that seems like it would be able to take the flow definition and create a new flow from it. However, it doesn't seem to recognize the "File content" of that .json file as valid input.

 

Here is the action as I have it configured:

ChadVKealey_0-1614795402194.png

 

And this is the error I get when saving the flow:

Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'Flow' validation failed in workflow operation 'Create_Flow': The parameter with value '"@outputs('Get_file_content')?['body']"' in path 'Flow/properties/definition' with type/format 'String/binary' is not convertible to type/format 'Object'.'.

 

So, it seems to not recognize the file content as valid json, but I'm not sure why. I mean, the "create file" action is literally just shoving the "Flow definition" in as the content of the file, so going in reverse should (in theory) work.

 

Any ideas on this?

12 REPLIES 12
DamoBird365
Employee
Employee

Hi @ChadVKealey 

 

Now that is pretty cool.  Never knew those options were available.  In a situation like this, I would use a compose to see that the contents of the variable file content look like.  It's obvioulsy not in the format the step is looking for and if you see it first hand, you'll be able to put it right.  You can initiliaze a new variable as an object and drop the file content in there too - it might also give you a heads up as to what is wrong.

 

Interested to see what this one brings.

 

Damien

DamoBird365
Employee
Employee

P.S. @ChadVKealey 

 

When I have done a get flow -> create flow with the JSON template being copied from one to the other, it works first time, so the file you have saved must be doing something with the content - the compose will definitely help you identify this.  This has given me an idea for staff to be able to request common personal flow type routines - all automated of course.

 

DamoBird365_0-1614796785928.png

 

Damien

Well, I got the flow to save and run successfully by wrapping the file content in the "json()" expression (in a compose action). The flow was created, but didn't work. It was a really simple one that just collected a list of groups I own (using the Office Groups connector) and put them into an HTML table. When the new flow was created, the List groups that I owned action shows "Connector not found". 

 

When I first discovered the Power Automate connectors, I dug around for a way to "export" flows, but there is no action for that. Saving the definition to a json file is great, but if I can't use that file to "reconstitute" the flow, it's kind of useless. I mean, the json is kind of readable to understand what the flow does, but rebuilding one manually using that as a guide would be a real pain. 

 

So, I guess I'll stick with turning those unused flows off, at least until I can figure out programmatic way to back them up in a restorable format. It's a shame there's no action to replicate the "export to zip" option in the GUI.

ChadVKealey
Memorable Member
Memorable Member

I tried the same process with another flow and got very similar results. Basically, any action (other than "internal"/built-in actions like initializing or setting variables or doing date/time conversions) shows the same "Connection not found" message.

ChadVKealey_0-1614804704684.png

 

I suspect that the "connectionReferences" array in the Create Flow action may need to be populated in some way, but that would mean parsing that information out of the json definition. I'm not confident enough in my skills to attempt that.

ChadVKealey_1-1614804953986.png

 

Hi @ChadVKealey 

 

Connection references are an output from the get flow - must be doable 🙂

 

@outputs('Get_Flow')?['body/properties/connectionReferences']

 

Damien

Hrm...I just had a crazy thought that probably won't work. I'll post back here either way.

ChadVKealey
Memorable Member
Memorable Member

So, what I tried (which hasn't failed yet, but is still running) is saving the connectionReferences to a multi-line text field in my SP list of flows and attaching the .json file to that item. The new flow I built takes the flow definition from that attached file (wrapping the file content in a "json()" expression) and the connectionReferences from the mlot column (wrapping it in an "array()" expression). Probably won't work, but worth a shot.

ChadVKealey
Memorable Member
Memorable Member

OK, it did eventually fail with an error I've never seen before:

 

Cannot access child value on Newtonsoft.Json.Linq.JValue.
at Newtonsoft.Json.Linq.JToken.get_Item(Object key)

 

However, I think the connectionReferences part is a bit of a red herring. Using "peek code" to examine the underlying json of the trigger and actions in the original flow vs. the one generated by the "Create Flow" step reveals that some elements in the json are getting moved around. I suspect that is why the connections are, uh, reconnecting. 

 

Stepping back a bit, the point is that through the existing actions in the Power Automate Management connector, we have the ability to save the definition of an existing flow to a json file. We also have a "Create Flow" action that takes the "Flow definition" and builds a flow from it. However, that - for unknown reasons - does not work.

 

I've followed the pattern in the "Create a file in SharePoint to save modified Flows in JSON format daily" template for creating the .json file with the flow definition, so I assume I'm doing that right. I guess I may be jumping to an inaccurate conclusion thinking that that json file could be used in the "Create Flow" action to create a new copy of that flow.

 

 

ChadVKealey
Memorable Member
Memorable Member

I'm still looking for an answer on this, so I'll have to invoke some of Power Automate power hitters: @RezaDorrani @JonL @sergeluca @yashag2255 

 

To restate the question: The "Get Flow" action produces an output of "Flow Definition" which can be saved into a .json file. The "Create Flow" action has an input of "Flow Definition", which does take the contents of that .json file (when wrapped in the "json()" expression) and creates a new flow. However, it appears that the Connections are not properly created in that flow. 

 

Is there a method or mechanism for generating ("reconstituting") a flow from the Flow Definition saved in a .json file? Even if it means saving the connection info in a separate file?

MrKro
Employee
Employee

Dear @ChadVKealey 

I was able to use the Create Flow action from a text-based Flow definition using a setting like this:

MrKro_0-1625655699576.png

(*)Action: Initialize a variable; Name: flow; Type: string; Value: the Flow Definition json content without quotes.

MrKro_1-1625655796920.png

(*) Action: Compose; Input: (expression) json(variables('flow'))

Thanks to other answers above for the hints.

IMPORTANT: When using the Create Flow you must specify the connectionReferences input fields by using "Create Connection" action, or "Get the list of my connnection" action, so that all connections specified in the Flow Definition json are inputted into the action.

 

slx299
Helper III
Helper III

Hi

 

I tried method above but got into an error

OpenAPIConnection should nothave the property 'authentication'

 

ON

workflowrunactioninputsinvalidproperty

 

any ideas?

 

thank you

 

Almack64
Regular Visitor

Has anyone found the appropriate detailed documentation on how the "create flow" action is supposed to work?

Helpful resources

Announcements

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!    

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Users online (3,091)