cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
finnecs
Frequent Visitor

'Create Flow' error

I'm trying to use the Create Flow connector to reproduce an existing flow for new Sharepoint subsites. Initially I have used a Get Flow connector to get the JSON definition of the desired flow. However when I paste the JSON into the Create Flow box I get an error message saying "The flow cannot contain unsupported parameter function expressions. The expressions must be string literals". I have made zero changes to the JSON but for some reason it is being rejected. Has anyone else encountered this?

1 ACCEPTED SOLUTION

Accepted Solutions
finnecs
Frequent Visitor

Just as a follow up I was able to find a workaround - I was wanting to insert dynamic content into the JSON in the form if ID numbers from a Sharepoint list (these become the new Sharepoint site url, so are integral to automating the creation of flows that will action from said site). I couldn't really understand why it wasn't working, but my suspicion was that when I 'exposed' the JSON to the UI some portions of it were automatically converted to dynamic content which interfered with how it was read. As such I tried to keep the entire JSON wrapped up in a dynamic content object, and was able to make it work with a few Compose connectors:

 

  1. use a Get Flow connector to find the 'template' flow
  2. use Compose to convert the Flow definition from above to a string
  3. Compose to find & replace the template site url with the dynamic content
  4. Compose to convert the string back to JSON
  5. link the output of my last Compose connector to the definition field in the Create Flow connector. 

I'm sure there'll be a slicker way but this works at least.

View solution in original post

9 REPLIES 9

Is there any reason why you aren't just using the export and import feature in the Flow UI?

What do you mean by this?

 

The following option is there to export a flow to a zip file. 

 

 

Export Flow.png

 

Then you import the flow using the import option

 

Import flow.PNG

I'm trying to automate the process so that when a new site is created the new flow will be generated in the background

You might want to have a look at this series of posts.

https://dylanhaskins.com/power-platform-alm-devops-part-1/

 

The whole ALM story is not complete yet. The main battle is the connection between different environments.

I have used this connector in a similar fashion successfully but this is my first time seeing this error message

finnecs
Frequent Visitor

Just as a follow up I was able to find a workaround - I was wanting to insert dynamic content into the JSON in the form if ID numbers from a Sharepoint list (these become the new Sharepoint site url, so are integral to automating the creation of flows that will action from said site). I couldn't really understand why it wasn't working, but my suspicion was that when I 'exposed' the JSON to the UI some portions of it were automatically converted to dynamic content which interfered with how it was read. As such I tried to keep the entire JSON wrapped up in a dynamic content object, and was able to make it work with a few Compose connectors:

 

  1. use a Get Flow connector to find the 'template' flow
  2. use Compose to convert the Flow definition from above to a string
  3. Compose to find & replace the template site url with the dynamic content
  4. Compose to convert the string back to JSON
  5. link the output of my last Compose connector to the definition field in the Create Flow connector. 

I'm sure there'll be a slicker way but this works at least.

Thanks for sharing this very useful workaround. I used the same with success and it was really hard to get info about the Create Flow action with Power Automate Management connector because theses search terms are very common. Search engines weren't really helpful with it.

mhuyser
Frequent Visitor

@finnecs has the right solution and it's much more clear than some other blog posts or videos on this subject. The Flow Definition is particularly complicated and annoying to work with. I'm responding to this thread in order to provide some more detail on how I've implemented the solution.

 

First, my Base Flow is triggered by changes in a document library. My project is to streamline the creation of new document libraries based on user inputs, which will also create a new flow dedicated to that new library.

 

I used a select data operation to map the connection references from the base flow:

mhuyser_0-1658370465033.png

 

The Flow Definition was prepared similarly to what @finnecs describes, but with a single compose connector:

mhuyser_1-1658370574128.png

 

 

json(replace(string(outputs('Get_Base_Flow')?['body/properties/definition']),body('Parse_JSON_2')?['d']?['Id'],body('Parse_JSON')?['d']?['Id']))

 

 

As @finnecs described, the first step is to convert the File Definition from the Get Base Flow connector to a string.

The second step was replacing the Library Id from the original flow with the new Library Id that was just created (what is replaced in each project will be highly dependent on what the copied flow is intended to do). The third part returns the format to JSON so that the output of this connector can be called in the Create Flow connector

 

mhuyser_2-1658370990919.png

(The Flow Definition is populated by the output of Compose 2, the connectionReferences is populated by the output of Select)

 

For informational purposes on how I collected the Library IDs, I created separate HTTP requests and then a companion Parse JSON connector for easy referencing. The image below illustrates the one set for the new Library. Note that the Output reference in the Uri field is calling a Library Name that was defined earlier in the flow. The same field in the second set is not dynamic since it only needs to know the template library name.

mhuyser_3-1658371596080.png

 

 

 

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,051)